Security Protection Method and Apparatus

ABSTRACT

A security protection method and an apparatus to implement security protection for a plurality of non-access stratum (NAS) connection links. The method includes determining, by a terminal, a first parameter, where the first parameter is used to indicate an access technology used to transmit a non-access stratum NAS message. The terminal can support at least two access technologies, and can separately maintain a corresponding NAS COUNT for each of the at least two access technologies. The method further includes performing, by the terminal, security protection on the NAS message based on the first parameter, a NAS key, and a NAS COUNT corresponding to an access technology used to transmit the NAS message.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/404,163, filed on May 6, 2019, which is a continuation ofInternational Patent Application No. PCT/CN2018/112897, filed on Oct.31, 2018, which claims priority to Chinese Patent Application No.201711148926.5, filed on Nov. 17, 2017. The disclosures of theaforementioned applications are hereby incorporated by reference intheir entireties.

TECHNICAL FIELD

Embodiments of this application relate to the field of wirelesscommunications technologies, and in particular, to a security protectionmethod and an apparatus.

BACKGROUND

In a 5th Generation (5G) system, a terminal may access an Access andMobility Management Function (AMF) node via only a 3rd GenerationPartnership Project (3GPP) access technology, or via only a non-3GPP(non-3GPP) access technology, or via both a 3GPP access technology and anon-3GPP access technology. When the terminal accesses the AMF node viaboth the 3GPP access technology and the non-3GPP access technology,there are two non-access stratum (NAS) connection links between theterminal and the AMF node at the same time. If the terminal uses one setof NAS keys and one set of NAS COUNTs to separately protect the twoconnection links, the following case may occur: the AMF node firstreceives a relatively small NAS COUNT transmitted through one link, andthen receives a relatively large NAS COUNT transmitted through the otherlink. Consequently, a replay attack occurs, resulting in a problem ofrelatively poor data security of NAS connection link transmissionbetween the terminal and the AMF node. Therefore, when a plurality ofNAS connection links exist between the terminal and the AMF node, how toperform security protection on the plurality of NAS connection links isan urgent problem to be resolved.

SUMMARY

Embodiments of this application provide a security protection method andan apparatus, to implement security protection for a plurality of NASconnection links.

To achieve the foregoing objectives, the following technical solutionsare provided in the embodiments of this application.

An embodiment of this application provides a security protection method.The method includes determining, by a terminal, a first parameter, andthen performing security protection on a NAS message based on the firstparameter, a NAS key, and a NAS COUNT corresponding to an accesstechnology used to transmit the NAS message. The first parameter is aninput parameter used when the terminal performs security protection onthe NAS message, and is used to indicate the access technology used totransmit the NAS message. The terminal can support at least two accesstechnologies, and can separately maintain a corresponding NAS COUNT foreach of the at least two access technologies.

For example, the at least two access technologies supported by theterminal may include a 3GPP access technology and a different accesstechnology that can share the same 3GPP network core network device withthe 3GPP access technology. The different access technology could be,for example, a non-3GPP access technology or a fixed network accesstechnology.

Optionally, the first parameter may be further used to indicate atransmission path used by the terminal to transmit the NAS message, andthe terminal can separately maintain a corresponding NAS COUNT for eachtransmission path used to transmit NAS messages.

The first parameter may be an input parameter newly added in anencryption/decryption process or an integrity protection process, forexample, an ACCESS parameter. A bit of the ACCESS parameter may be setto different values to represent different access technologies. Forexample, if the first parameter is 00, it indicates that the 3GPP accesstechnology is used. As another example, if the first parameter is 01, itindicates that the non-3GPP access technology is used. Alternatively,the first parameter may be all or some bits of the existing inputparameter COUNT in an encryption/decryption process or an integrityprotection process, or the first parameter may be all or some bits ofthe existing input parameter BEARER in an encryption/decryption processor an integrity protection process.

The NAS key is common to the at least two access technologies supportedby the terminal.

According to this method, the terminal can separately maintain thecorresponding NAS COUNTs for each of the at least two accesstechnologies. The terminal does not use the same set of NAS COUNTs whentransmitting NAS messages via different access technologies. Instead,the terminal performs security protection on the NAS message using a NASCOUNT maintained for a corresponding access technology. This can avoid areplay attack problem that occurs when a core network device firstreceives a relatively small NAS COUNT transmitted using one link, andthen receives a relatively large NAS COUNT transmitted using anotherlink. In addition, in this application, the first parameter used todifferentiate different access technologies is further used whensecurity protection is performed on the NAS message. Therefore, even ifa same NAS key and a same NAS COUNT are used when security protection isperformed on a NAS message transmitted via the different accesstechnologies, security protection results of the NAS message aredifferent, reducing a possibility of occurrence of a replay attack,thereby implementing security protection for a plurality of NASconnection links.

In a possible design, the at least two access technologies include afirst access technology. If the access technology used to transmit theNAS message is the first access technology, before the terminaldetermines the first parameter, the terminal may determine a firstuplink NAS COUNT corresponding to the first access technology, and thenthe terminal sends a first message to the core network device, wheresecurity protection is performed on the first message using the firstuplink NAS COUNT and the NAS key, and the first message carries some orall bits of the first uplink NAS COUNT.

For example, the first access technology may be a non-3GPP accesstechnology.

In a possible implementation, the start value of the first uplink NASCOUNT is 0, wherein some or all bits of the first uplink NAS COUNT is 0.Alternatively, the first uplink NAS COUNT is a random number. In someembodiments, some or all bits in the first uplink NAS COUNT are randomnumbers. For example, a Sequence Number part or a NAS overflow part ofthe first uplink NAS COUNT is a random number. In this case, a remainingpart is 0. Alternatively, the at least two access technologies furtherinclude a second access technology, and the first uplink NAS COUNT is anuplink NAS COUNT that corresponds to the second access technology andthat is stored by the terminal. If the terminal stores at least twouplink NAS COUNTs corresponding to the second access technology, thefirst uplink NAS COUNT is a largest uplink NAS COUNT that corresponds tothe second access technology and that is stored by the terminal.Alternatively, the at least two access technologies further include asecond access technology, and the first uplink NAS COUNT is a sum of 1and an uplink NAS COUNT that corresponds to the second access technologyand that is stored by the terminal. If the terminal stores at least twouplink NAS COUNTs corresponding to the second access technology, thefirst uplink NAS COUNT is a sum of 1 and a largest uplink NAS COUNT thatcorresponds to the second access technology and that is stored by theterminal. Alternatively, the first uplink NAS COUNT is an uplink NASCOUNT that corresponds to the first access technology and that is storedby the terminal. If the terminal stores at least two uplink NAS COUNTscorresponding to the first access technology, the first uplink NAS COUNTis a largest uplink NAS COUNT that corresponds to the first accesstechnology and that is stored by the terminal. Alternatively, the firstuplink NAS COUNT is a sum of 1 and an uplink NAS COUNT that correspondsto the first access technology and that is stored by the terminal. Ifthe terminal stores at least two uplink NAS COUNTs corresponding to thefirst access technology, the first uplink NAS COUNT is a sum of 1 and alargest uplink NAS COUNT that corresponds to the first access technologyand that is stored by the terminal.

In another possible design, the at least two access technologies includea first access technology and a second access technology. If the accesstechnology used to transmit the NAS message is the first accesstechnology, before the terminal determines the first parameter, theterminal may send a first message to the core network device, wheresecurity protection is performed on the first message using the NAS keyand an uplink NAS COUNT corresponding to the second access technology,and the first message carries some or all bits of the uplink NAS COUNTcorresponding to the second access technology.

The second access technology is a 3GPP access technology. Optionally, apremise for implementing this design is that the terminal has accessedthe core network device via the 3GPP access technology.

In a possible design, the first message may carry first indicationinformation, and the first indication information is used to indicate anaccess technology corresponding to some or all bits of the uplink NASCOUNT carried in the first message. Optionally, the first indicationinformation may be further used to indicate a transmission pathcorresponding to some or all bits of the uplink NAS COUNT carried in thefirst message.

In a possible design, the terminal receives a second message from thecore network device, where the second message includes one or both of asecond uplink NAS COUNT and a first downlink NAS COUNT that arecorresponding to the first access technology.

Optionally, the second message may include the first downlink NAS COUNTcorresponding to the first access technology. Alternatively, the secondmessage includes both the second uplink NAS COUNT and the first downlinkNAS COUNT that are corresponding to the first access technology.

Optionally, the second uplink NAS COUNT and the first downlink NAS COUNTthat are corresponding to the first access technology are the same.

In a possible implementation, the start value of the second uplink NASCOUNT is 0, wherein all or some bits of the second uplink NAS COUNT are0. Alternatively, the second uplink NAS COUNT is a random number. Insome embodiments, some or all bits in the second uplink NAS COUNT arerandom numbers. For example, a Sequence Number part or a NAS overflowpart of the second uplink NAS COUNT is a random number. In this case, aremaining part is 0. Alternatively, the second uplink NAS COUNT is adownlink NAS COUNT that corresponds to the second access technology andthat is stored by the core network device. If the core network devicestores at least two downlink NAS COUNTs corresponding to the secondaccess technology, the second uplink NAS COUNT is a largest downlink NASCOUNT that corresponds to the second access technology and that isstored by the core network device. Alternatively, the second uplink NASCOUNT is a sum of 1 and a downlink NAS COUNT that corresponds to thesecond access technology and that is stored by the core network device.If the core network device stores at least two downlink NAS COUNTscorresponding to the second access technology, the second uplink NASCOUNT is a sum of 1 and a largest downlink NAS COUNT that corresponds tothe second access technology and that is stored by the core networkdevice. Alternatively, the second uplink NAS COUNT is a sum of 1 and adownlink NAS COUNT that corresponds to the first access technology andthat is stored by the core network device. If the core network devicestores at least two downlink NAS COUNTs corresponding to the firstaccess technology, the second uplink NAS COUNT is a sum of 1 and alargest downlink NAS COUNT that corresponds to the first accesstechnology and that is stored by the core network device. Alternatively,the second uplink NAS COUNT is the first uplink NAS COUNT; or the seconduplink NAS COUNT is a sum of 1 and the first uplink NAS COUNT.

In a possible design, the start value of the first downlink NAS COUNT is0, wherein all or some bits of the first downlink NAS COUNT are 0.Alternatively, the first downlink NAS COUNT is a random number. In someembodiments, some or all bits in the first downlink NAS COUNT are randomnumbers. For example, a Sequence Number part or a NAS overflow part ofthe first downlink NAS COUNT is a random number. In this case, aremaining part is 0. Alternatively, the first downlink NAS COUNT is adownlink NAS COUNT that corresponds to the second access technology andthat is stored by the core network device. If the core network devicestores at least two downlink NAS COUNTs corresponding to the secondaccess technology, the first downlink NAS COUNT is a largest downlinkNAS COUNT that corresponds to the second access technology and that isstored by the core network device. Alternatively, the first downlink NASCOUNT is a sum of 1 and a downlink NAS COUNT that corresponds to thesecond access technology and that is stored by the core network device.If the core network device stores at least two downlink NAS COUNTscorresponding to the second access technology, the first downlink NASCOUNT is a sum of 1 and a largest downlink NAS COUNT that corresponds tothe second access technology and that is stored by the core networkdevice. Alternatively, the first downlink NAS COUNT is a sum of 1 and adownlink NAS COUNT that corresponds to the first access technology andthat is stored by the core network device. If the core network devicestores at least two downlink NAS COUNTs corresponding to the firstaccess technology, the first downlink NAS COUNT is a sum of 1 and alargest downlink NAS COUNT that corresponds to the first accesstechnology and that is stored by the core network device.

In a possible design, the second message carries second indicationinformation, and the second indication information is used to indicatean access technology corresponding to the first downlink NAS COUNTcarried in the second message. Optionally, the second message mayfurther carry indication information used to indicate the second uplinkNAS COUNT carried in the second message.

Optionally, the second indication information is used to indicate atransmission path corresponding to the first downlink NAS COUNT carriedin the second message. Optionally, the second message may further carryindication information that is used to indicate a transmission pathcorresponding to the second uplink NAS COUNT carried in the secondmessage.

According to a second aspect, an embodiment of this application providesa security protection method. The method includes determining, by a corenetwork device, a first parameter, and then performing, by the corenetwork device, security protection on a NAS message based on the firstparameter, a NAS key, and a NAS COUNT corresponding to an accesstechnology used to transmit the NAS message. The first parameter is usedto indicate an access technology used to transmit the NAS message. Thecore network device can separately maintain a corresponding NAS COUNTfor each of at least two access technologies supported by a terminal.

For example, the at least two access technologies supported by theterminal may include a 3GPP access technology and a different accesstechnology. The different access technology could be, for example, anon-3GPP access technology or a fixed network access technology.

Optionally, the first parameter may be further used to indicate atransmission path used by the core network device to transmit the NASmessage, and the core network device can separately maintain acorresponding NAS COUNT for each transmission path used to transmit NASmessages.

The first parameter may be an input parameter newly added in anencryption/decryption process or an integrity protection process, forexample, an ACCESS parameter. A bit of the ACCESS parameter may be setto different values to represent different access technologies. Forexample, if the first parameter is 00, the 3GPP access technology isused; or if the first parameter is 01, the non-3GPP access technology isused. Alternatively, the first parameter may further be all or some bitsof the existing input parameter COUNT in an encryption/decryptionprocess or an integrity protection process. Alternatively, the firstparameter may be all or some bits of the existing input parameter BEARERin an encryption/decryption process or an integrity protection process.

The NAS key is common to the at least two access technologies supportedby the terminal.

According to this method, the core network device can separatelymaintain the corresponding NAS COUNTS for each of the at least twoaccess technologies. The terminal does not use one set of NAS COUNTswhen transmitting the NAS message using different access technologies.Instead, the core network device performs security protection on the NASmessage using a NAS COUNT maintained for a corresponding accesstechnology. This can avoid a replay attack problem that occurs when aterminal first receives a relatively small NAS COUNT transmitted usingone link, and then receives a relatively large NAS COUNT transmittedusing another link. In addition, in this application, the firstparameter used to differentiate different access technologies is furtherused when security protection is performed on the NAS message.Therefore, even if a same NAS key and a same NAS COUNT are used whensecurity protection is performed on a NAS message transmitted via thedifferent access technologies, security protection results of the NASmessage are different, reducing a possibility of occurrence of a replayattack, thereby implementing security protection for a plurality of NASconnection links.

In a possible design, the at least two access technologies include afirst access technology. If the access technology used to transmit theNAS message is the first access technology, before the core networkdevice determines the first parameter, the core network device mayreceive a first message, where security protection is performed on thefirst message using the NAS key and a first uplink NAS COUNTcorresponding to the first access technology, and the first messagecarries a first uplink NAS COUNT.

For example, the first access technology may be a non-3GPP accesstechnology.

In a possible implementation, the start value of the first uplink NASCOUNT is 0, wherein a bit, some bits, or all bits of the first uplinkNAS COUNT is 0. Alternatively, the first uplink NAS COUNT is a randomnumber. In some embodiments, some or all bits in the first uplink NASCOUNT are random numbers. For example, a Sequence Number part or a NASoverflow part of the first uplink NAS COUNT is a random number. In thiscase, a remaining part is 0. Alternatively, the at least two accesstechnologies further include a second access technology, and the firstuplink NAS COUNT is an uplink NAS COUNT that corresponds to the secondaccess technology and that is stored by the terminal. If the terminalstores at least two uplink NAS COUNTs corresponding to the second accesstechnology, the first uplink NAS COUNT is a largest uplink NAS COUNTthat corresponds to the second access technology and that is stored bythe terminal. Alternatively, the at least two access technologiesfurther include a second access technology, and the first uplink NASCOUNT is a sum of 1 and an uplink NAS COUNT that corresponds to thesecond access technology and that is stored by the terminal. If theterminal stores at least two uplink NAS COUNTs corresponding to thesecond access technology, the first uplink NAS COUNT is a sum of 1 and alargest uplink NAS COUNT that corresponds to the second accesstechnology and that is stored by the terminal. Alternatively, the firstuplink NAS COUNT is an uplink NAS COUNT that corresponds to the firstaccess technology and that is stored by the terminal. If the terminalstores at least two uplink NAS COUNTs corresponding to the first accesstechnology, the first uplink NAS COUNT is a largest uplink NAS COUNTthat corresponds to the first access technology and that is stored bythe terminal. Alternatively, the first uplink NAS COUNT is a sum of 1and an uplink NAS COUNT that corresponds to the first access technologyand that is stored by the terminal. If the terminal stores at least twouplink NAS COUNTs corresponding to the first access technology, thefirst uplink NAS COUNT is a sum of 1 and a largest uplink NAS COUNT thatcorresponds to the first access technology and that is stored by theterminal.

In another possible design, the at least two access technologies includea first access technology and a second access technology. If the accesstechnology used to transmit the NAS message is the first accesstechnology, before the core network device determines the firstparameter, the core network device may receive a first message, wheresecurity protection is performed on the first message using the NAS keyand an uplink NAS COUNT corresponding to the second access technology,and the first message carries a bit, some bits, or all bits of theuplink NAS COUNT corresponding to the second access technology.

The second access technology is a 3GPP access technology. Optionally, apremise for implementing this design is that the terminal has accessedthe core network device using the 3GPP access technology.

In a possible design, the first message carries first indicationinformation, and the first indication information is used to indicate anaccess technology corresponding to a bit, some bits, or all bits of theuplink NAS COUNT carried in the first message. Optionally, the firstindication information may be further used to indicate a transmissionpath corresponding to a bit, some bits, or all bits of the uplink NASCOUNT carried in the first message.

In a possible design, after the core network device receives the firstmessage from the terminal, the core network device verifies, accordingto the uplink NAS COUNT corresponding to the access technology indicatedby the first indication information, a bit, some bits, or all bits ofthe NAS COUNT carried in the first message.

In this embodiment of this application, the core network device mayindependently maintain a NAS COUNT of the 3GPP access technology and aNAS COUNT of the non-3GPP access technology, and further verify thereceived uplink NAS COUNT according to an uplink NAS COUNT maintained bythe core network device, thereby reducing a possibility of occurrence ofa replay attack.

In a possible design, the core network device determines one or both ofa second uplink NAS COUNT and a first downlink NAS COUNT that arecorresponding to the first access technology, and then the core networkdevice sends a second message to the terminal, where the second messageincludes one or both of the second uplink NAS COUNT and the firstdownlink NAS COUNT that are corresponding to the first accesstechnology.

Optionally, the second message may include the first downlink NAS COUNTcorresponding to the first access technology. Alternatively, the secondmessage includes both the second uplink NAS COUNT and the first downlinkNAS COUNT that are corresponding to the first access technology.

Optionally, the second uplink NAS COUNT and the first downlink NAS COUNTthat are corresponding to the first access technology are the same.

In a possible implementation, the start value of the second uplink NASCOUNT is 0, wherein all or some bits of the second uplink NAS COUNT are0. Alternatively, the second uplink NAS COUNT is a random number. Insome embodiments, some or all bits in the second uplink NAS COUNT arerandom numbers. For example, a Sequence Number part or a NAS overflowpart of the second uplink NAS COUNT is a random number. In this case, aremaining part is 0. Alternatively, the second uplink NAS COUNT is adownlink NAS COUNT that corresponds to the second access technology andthat is stored by the core network device. If the core network devicestores at least two downlink NAS COUNTs corresponding to the secondaccess technology, the second uplink NAS COUNT is a largest downlink NASCOUNT that corresponds to the second access technology and that isstored by the core network device. Alternatively, the second uplink NASCOUNT is a sum of 1 and a downlink NAS COUNT that corresponds to thesecond access technology and that is stored by the core network device.If the core network device stores at least two downlink NAS COUNTscorresponding to the second access technology, the second uplink NASCOUNT is a sum of 1 and a largest downlink NAS COUNT that corresponds tothe second access technology and that is stored by the core networkdevice. Alternatively, the second uplink NAS COUNT is a sum of 1 and adownlink NAS COUNT that corresponds to the first access technology andthat is stored by the core network device. If the core network devicestores at least two downlink NAS COUNTs corresponding to the firstaccess technology, the second uplink NAS COUNT is a sum of 1 and alargest downlink NAS COUNT that corresponds to the first accesstechnology and that is stored by the core network device. Alternatively,the second uplink NAS COUNT is the first uplink NAS COUNT, or the seconduplink NAS COUNT is a sum of 1 and the first uplink NAS COUNT.

In a possible implementation, the start value of the first downlink NASCOUNT is 0, wherein all or some bits of the first downlink NAS COUNT are0. Alternatively, the first downlink NAS COUNT is a random number. Insome embodiments, some or all bits in the first downlink NAS COUNT arerandom numbers. For example, a Sequence Number part or a NAS overflowpart of the first downlink NAS COUNT is a random number. In this case, aremaining part is 0. Alternatively, the first downlink NAS COUNT is adownlink NAS COUNT that corresponds to the second access technology andthat is stored by the core network device. If the core network devicestores at least two downlink NAS COUNTs corresponding to the secondaccess technology, the first downlink NAS COUNT is a largest downlinkNAS COUNT that corresponds to the second access technology and that isstored by the core network device. Alternatively, the first downlink NASCOUNT is a sum of 1 and a downlink NAS COUNT that corresponds to thesecond access technology and that is stored by the core network device.If the core network device stores at least two downlink NAS COUNTscorresponding to the second access technology, the first downlink NASCOUNT is a sum of 1 and a largest downlink NAS COUNT that corresponds tothe second access technology and that is stored by the core networkdevice. Alternatively, the first downlink NAS COUNT is a sum of 1 and adownlink NAS COUNT that corresponds to the first access technology andthat is stored by the core network device. If the core network devicestores at least two downlink NAS COUNTs corresponding to the firstaccess technology, the first downlink NAS COUNT is a sum of 1 and alargest downlink NAS COUNT that corresponds to the first accesstechnology and that is stored by the core network device.

In a possible design, the second message carries second indicationinformation, and the second indication information is used to indicatean access technology corresponding to the first downlink NAS COUNTcarried in the second message. Optionally, the second message mayfurther carry indication information used to indicate the second uplinkNAS COUNT carried in the second message.

Optionally, the second indication information is used to indicate atransmission path corresponding to the first downlink NAS COUNT carriedin the second message. Optionally, the second message may further carryindication information that is used to indicate a transmission pathcorresponding to the second uplink NAS COUNT carried in the secondmessage.

According to a third aspect, an embodiment of this application providesan apparatus, and the apparatus has a function of implementing actionsof a terminal in the foregoing method design. The function may beimplemented by hardware, or may be implemented by hardware executingcorresponding software. The hardware or software includes one or moremodules corresponding to the foregoing function. For example, theapparatus may be a terminal, or may be a chip in a terminal.

In a possible design, the apparatus is a terminal, and the terminalincludes a processor. The processor is configured to support theterminal in performing the corresponding function in the foregoingmethod. Further, the terminal may further include a transmitter and areceiver, where the transmitter and the receiver are configured tosupport communication between the terminal and a core network device.Further, the terminal may further include a memory, and the memory isconfigured to couple to the processor, and store a program instructionand data that are necessary to the terminal.

According to a fourth aspect, an embodiment of this application providesan apparatus, and the apparatus has a function of implementing actionsof a core network device in the foregoing method design. The functionmay be implemented by hardware, or may be implemented by hardwareexecuting corresponding software. The hardware or software includes oneor more modules corresponding to the foregoing function. For example,the apparatus may be a core network device, or may be a chip in a corenetwork device.

In a possible design, the apparatus is a core network device, and thecore network device includes a processor. The processor is configured tosupport the core network device in performing a corresponding functionin the foregoing method. Further, the core network device may furtherinclude a transmitter and a receiver, where the transmitter and thereceiver are configured to support communication between the corenetwork device and a terminal. Further, the core network device mayfurther include a memory, and the memory is configured to couple to theprocessor, and store a program instruction and data that are necessaryto the terminal.

According to a fifth aspect, an embodiment of this application providesa communications system, where the system includes the terminal and thecore network device described in the foregoing aspects. Optionally, thesystem may further include a base station, an N3IWF node, and theterminal and the core network device described in the foregoing aspects.

According to a sixth aspect, an embodiment of this application providesa computer storage medium, configured to store a computer softwareinstruction used by the foregoing terminal, where the computer softwareinstruction includes a program designed to execute the first aspect.

According to a seventh aspect, an embodiment of this applicationprovides a computer storage medium configured to store a computersoftware instruction used by the foregoing core network device. Thecomputer software instruction includes a program designed to execute thesecond aspect.

According to an eighth aspect, an embodiment of this applicationprovides a computer program product including an instruction. When acomputer runs the instruction, the computer is enabled to perform themethod in the first aspect.

According to a ninth aspect, an embodiment of this application providesa computer program product including an instruction. When a computerruns the instruction, the computer is enabled to perform the method inthe second aspect.

According to a tenth aspect, an embodiment of this application providesa chip system applied to a terminal, where the chip system includes atleast one processor, at least one memory, and at least one transceivercircuit. The at least one memory, the at least one transceiver circuit,and the at least one processor are connected to each other throughlines. The at least one memory stores an instruction. The instruction isexecuted by the at least one processor, to execute operations of theterminal in the method described in the first aspect.

According to an eleventh aspect, an embodiment of this applicationprovides a chip system applied to a core network device, where the chipsystem includes at least one processor, at least one memory, and atleast one transceiver circuit. The at least one memory, the at least onetransceiver circuit, and the at least one processor are connected toeach other through lines. The at least one memory stores an instruction.The instruction is executed by the at least one processor, to executeoperations of the core network device in the method described in thesecond aspect.

According to the security protection method provided in the embodimentsof this application, the terminal can separately maintain thecorresponding NAS COUNT for each of the at least two accesstechnologies. The terminal does not use one set of NAS COUNTS whentransmitting the NAS message via different access technologies. Instead,the terminal performs security protection on the NAS message using a NASCOUNT maintained for a corresponding access technology. This can avoid areplay attack problem that occurs when the core network device firstreceives a relatively small NAS COUNT transmitted using one link, andthen receives a relatively large NAS COUNT transmitted via another link.In addition, in this application, the first parameter used todifferentiate different access technologies is further used whensecurity protection is performed on the NAS message. Therefore, even ifa same NAS key and a same NAS COUNT are used when security protection isperformed on a NAS message transmitted via the different accesstechnologies, security protection results of the NAS message aredifferent, reducing a possibility of occurrence of a replay attack,thereby implementing security protection for a plurality of NASconnection links.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic diagram of a possible network architectureaccording to an embodiment of this application;

FIG. 2 is a schematic diagram of another possible network architectureaccording to an embodiment of this application;

FIG. 3 is an example of a schematic diagram of an encryption anddecryption method according to an embodiment of this application;

FIG. 4 is an example of a schematic diagram of an integrity protectionmethod according to an embodiment of this application;

FIG. 5 is a flowchart of a security protection method according to anembodiment of this application;

FIG. 6 is an example of a schematic diagram of another encryption anddecryption method according to an embodiment of this application;

FIG. 7 is an example of a schematic diagram of still another encryptionand decryption method according to an embodiment of this application;

FIG. 8 is an example of a schematic diagram of yet another encryptionand decryption method according to an embodiment of this application;

FIG. 9 is a flowchart of another security protection method according toan embodiment of this application;

FIG. 10 is a flowchart of still another security protection methodaccording to an embodiment of this application;

FIG. 11A and FIG. 11B are flowcharts of yet another security protectionmethod according to an embodiment of this application;

FIG. 12 is a schematic structural diagram of an apparatus according toan embodiment of this application;

FIG. 13 is a schematic structural diagram of a terminal according to anembodiment of this application;

FIG. 14 is a schematic structural diagram of another apparatus accordingto an embodiment of this application; and

FIG. 15 is a schematic structural diagram of a core network deviceaccording to an embodiment of this application.

DESCRIPTION OF EMBODIMENTS

The following further describes this application in detail withreference to accompanying drawings. An operation method in methodembodiments may also be applied to an apparatus embodiment or a systemembodiment. In descriptions of this application, unless otherwisespecified, “a plurality of” means two or more than two.

A system architecture and a service scenario described in thisapplication are intended to more clearly describe the technicalsolutions in this application, but are not intended to limit thetechnical solutions provided in this application. A person of ordinaryskill in the art may know that as the system architecture evolves and anew service scenario emerges, the technical solutions provided in thisapplication are also applicable to a similar technical problem.

It should be noted that, in this application, a term such as “example”or “for example” is used as an example to represent giving anillustration, or a description. Any embodiment or design solutiondescribed as an “example” or “for example” in this application shouldnot be explained as being more preferred or having more advantages thananother embodiment or design solution. That is, use of the word“example”, or “for example”, or the like is intended to present arelated concept in a certain manner.

Embodiments of this application may be applied to a next-generationwireless communications system, for example, a 5G communications system.FIG. 1 shows a schematic diagram of a possible network architectureaccording to this application. The network architecture includes thefollowing.

An AMF node is a network element responsible for mobility management,and may be configured to implement a function other than sessionmanagement in mobility management entity (MME) functions, for example, afunction such as lawful interception or access authorization.

A Session Management Function (SMF) node is configured to allocate asession resource to a user plane.

An Authentication Server Function (AUSF) node is responsible forperforming authentication on a terminal, such as verifying andtransferring a to-be-authenticated parameter, and authenticatingauthenticity of the terminal. Main functions include: receiving anauthentication request sent by a Security Anchor Function (SEAF) node,and selecting an authentication method. When an ExtensibleAuthentication Protocol Method for 3rd Generation Authentication and KeyAgreement (EAP-AKA′) authentication method is used, the AUSF node maycomplete authentication from a network side to the terminal.

An SEAF node may be a part of the AMF node, or may be an independentnetwork element, and is mainly responsible for initiating anauthentication request to the AUSF node and completing authenticationfrom the network side to the terminal in an authentication process ofEvolved Packet System Authentication and Key Agreement (EPS-AKA*).

A User Plane Function (UPF) node is an egress of user plane data, and isconfigured to connect to an external network.

A data network (DN) is a network used to provide external data, forexample, the Internet.

A (radio) access network ((R)AN) node may use different accesstechnologies. Currently, there are two types of radio accesstechnologies: a 3GPP access technology (for example, a radio accesstechnology used in a 3G, 4G, or 5G system) and a non-3GPP accesstechnology. The 3GPP access technology is an access technology thatcomplies with a 3GPP standard specification. An access network using the3GPP access technology is a radio access network (RAN). An accessnetwork device in the 5G system is referred to as a next generation basestation or next generation nodeB (gNB). The non-3GPP access technologyis an access technology that does not comply with the 3GPP standardspecification, for example, a radio technology represented by a Wi-Fiaccess point (AP).

A terminal in this application is a device that has wirelesstransmission and reception functions. The terminal may be deployed onland, for example, an indoor device, an outdoor device, a handhelddevice, or an in-vehicle device. Alternatively, the terminal may bedeployed on the water (for example, on a ship), or may be deployed inthe air (for example, on a plane, a balloon, or a satellite). Theterminal may include various types of user equipment (UE), mobilephones, tablet computers, computers with wireless transmission andreception functions, wireless data cards, virtual reality (VR) terminaldevices, augmented reality (AR) terminal devices, machine typecommunication (MTC) terminal devices, terminal devices in industrialcontrol, self-driving terminal devices, remote medical terminal devices,smart grid terminal devices, terminal devices in transportation safety,terminal devices in a smart city, wearable devices (such as asmartwatch, a smart band, and a pedometer), or the like. Terminalshaving similar wireless communication functions may have different namesin systems in which different radio access technologies are used. Forease of description, in the embodiments of this application, theforegoing apparatuses with wireless transmission and receptioncommunication functions are collectively referred to as terminals.

In some embodiments, the terminal in this application stores a long-termkey and a related function. When performing two-way authentication witha core network node (such as an AMF node, an AUSF node, and an SEAFnode), the terminal may verify authenticity of a network using thelong-term key and the related function.

An access network device in the embodiments of this application is anapparatus that provides a wireless communication function for aterminal. For example, the access network device may be a base station(BS), and the base station may include various forms of macro basestations, micro base stations, relay stations, access points, or thelike. Devices having functions of a base station may have differentnames in systems in which different radio access technologies are used.For example, in the 5G system, a device having the functions of the basestation is referred to as a next generation node base station, and maybe represented as a gNB. In a Long Term Evolution (LTE) system, a devicehaving the functions of the base station is referred to as an evolvedNodeB (eNB or eNodeB). In a 3rd Generation (3G) communications system, adevice having the functions of the base station is referred to as aNodeB (Node B). For ease of description, in the embodiments of thepresent disclosure, the foregoing apparatuses that provide the wirelesscommunication function for the terminal are collectively referred to asaccess network devices.

A Network Exposure Function (NEF) node is mainly configured to interactwith a third party, such that the third party can indirectly interactwith a network element in some 3GPP networks.

A Network Repository Function (NRF) node is configured for inter-networkelement discovery and network function (NF) maintenance.

A Policy Control Function (PCF) node stores a latest quality of service(QoS) rule. A base station may allocate an appropriate resource to auser plane transmission channel according to a QoS rule provided by anSMF node.

A Unified Data Management (UDM) node is configured to store subscriptioninformation of a user.

An Application Function (AF) node may be located inside the DN, and is afunctional network element deployed in the third party. This networkelement is mainly configured to notify the PCF node of a latest servicerequirement of a third-party enterprise for an application. The PCF nodemay generate a corresponding QoS rule based on the service requirement,to ensure that a service provided by a network meets the requirementspecified by the third party.

In the embodiments of this application, the terminal may access the AMFnode using at least two access technologies. That the at least twoaccess technologies include the 3GPP access technology and the non-3GPPaccess technology is used as an example. An embodiment of thisapplication further provides a schematic diagram of a possible networkarchitecture. As shown in FIG. 2, the network architecture includes anAMF node, an AUSF node, an SMF node, a UPF node, a UDM node (or anAuthentication Credential Repository and Processing Function (APRF)node), a terminal, and a non-3GPP Interworking Function (N3IWF) node.

For the AMF node, the AUSF node, the SMF node, the UPF node, the UDMnode, and the terminal, refer to the description in FIG. 1. Details arenot described herein again.

The N3IWF node is configured to support the terminal in accessing theAMF node using the non-3GPP access technology.

With reference to the network architecture shown in FIG. 2, the terminalmay access the AMF node via both the 3GPP access technology and thenon-3GPP access technology. The 3GPP access technology may be simplyrepresented as 3GPP, and the non-3GPP access technology may be simplyrepresented as non-3GPP. A path 1 in FIG. 2 is a path over which theterminal accesses the AMF node via the 3GPP, and a path 2 is a path overwhich the terminal accesses the AMF node via the non-3GPP, in otherwords, the terminal may access the AMF node via the N3IWF node. When theterminal accesses the AMF node via both the 3GPP and non-3GPP, if theterminal needs to send a NAS message to the AMF node, in a possibleimplementation, the NAS message may be split into at least two messageblocks, where one or more of the message blocks are transmitted via the3GPP, and one or more of the message blocks are transmitted via thenon-3GPP. For example, the NAS message may be divided into a messageblock 1, a message block 2, a message block 3, a message block 4, and amessage block 5. The message blocks 2 and 4 are transmitted via the3GPP, and the message blocks 1, 3, and 5 are transmitted via thenon-3GPP. In another possible implementation, the terminal may transmitan entire NAS message via the 3GPP, and transmit another entire NASmessage via the non-3GPP.

First, terms related to the embodiments of this application areexplained.

(1) NAS COUNT

A NAS COUNT includes 24 bits including a 16-bit NAS overflow and an8-bit Sequence Number.

A start value of the NAS COUNT is 0. An uplink NAS COUNT is increased by1 each time the terminal sends one NAS message to the core networkdevice, and a downlink NAS COUNT is increased by 1 each time the corenetwork device sends one NAS message to the terminal. After anauthentication process from the terminal to the core network device iscompleted, both the uplink NAS COUNT and the downlink NAS COUNT are setto 0.

Optionally, there are two methods for maintaining the NAS COUNT, asfollows.

Method 1: After a NAS message is sent, a stored NAS COUNT is increasedby 1 and is stored. When a NAS message needs to be sent a subsequenttime, security protection is performed on the NAS message using thestored NAS COUNT.

Method 2: After a NAS message is sent, when a NAS message needs to besent a subsequent time, a stored NAS COUNT is increased by 1 to obtain anew NAS COUNT, and security protection is performed on the NAS messageusing the new NAS COUNT.

After receiving the NAS message, the terminal and the core networkdevice may verify whether a received NAS COUNT is reused, to be morespecific, verify whether the NAS COUNT carried in the NAS message isgreater than a previously received NAS COUNT. For example, if the AMFnode receives an uplink NAS COUNT from the terminal, the received uplinkNAS COUNT may be compared with a previously received uplink NAS COUNT.If the received uplink NAS COUNT is greater than the previously receiveduplink NAS COUNT, security verification performed on the NAS messagesucceeds.

When encryption and decryption, and integrity protection are performedusing the NAS COUNT, the NAS COUNT is padded to 32 bits. In other words,8 bits are padded in front of an original 24-bit NAS COUNT, where thepadded 8 bits may be all 0.

(2) Encryption and Decryption

FIG. 3 shows a process of encrypting and decrypting a NAS message.

Herein, the key may be a NAS key.

A COUNT used for encryption and decryption includes 32 bits, where thefirst 8 bits are 0, the middle 16 bits are a NAS overflow, and the last8 bits are a Sequence Number.

Bearer information (BEARER) includes 5 bits, and the 5 bits are all 0.

A data transmission direction (DIRECTION) is used to indicate uplink ordownlink. When encryption and decryption are performed on an uplink NASmessage, the DIRECTION indicates uplink. When encryption and decryptionare performed on a downlink NAS message, the DIRECTION indicatesdownlink.

A length (LENGTH) is used to indicate a data length of a NAS messagethat needs to be encrypted or decrypted.

An evolved packet system (EPS) encryption algorithm (EEA) is analgorithm used to encrypt and decrypt a NAS message.

An encryption process is as follows: performing EEA processing on inputparameters (the KEY, the COUNT, the BEARER, the DIRECTION, and theLENGTH), to obtain a keystream); and performing addition modulo 2 on thekeystream and a plaintext (a NAS message), to obtain a ciphertext. Adecryption process is as follows: performing EEA processing on theforegoing input parameters, to obtain the keystream; and performingaddition modulo 2 on the keystream and the ciphertext, to recover theplaintext.

(3) Integrity Protection

FIG. 4 shows a process of performing integrity protection and integrityprotection verification on a NAS message.

A message (MESSAGE) is a message on which integrity protection needs tobe performed, and may be a NAS message.

An EPS integrity algorithm (EIA) is shown in FIG. 4.

An integrity protection method is as follows: a transmit end performsEIA processing on the input parameters (the KEY, the COUNT, the MESSAGE,the BEARER, and the DIRECTION) to obtain an expected messageauthentication code for integrity (MAC-I) or a NAS-MAC. An integrityprotection verification method is as follows: performing EIA processingon the input parameters (the KEY, the COUNT, the MESSAGE, the BEARER,and the DIRECTION), to obtain an expected message authentication codefor integrity (XMAC-I) or an XNAS-MAC; comparing the XMAC-I with theMAC-I; and if the XMAC-I is consistent with the MAC-I, determining thatintegrity protection verification succeeds.

The following describes in detail the technical solutions provided inthis application.

Based on the network architectures in FIG. 1 and FIG. 2, an embodimentof this application provides a security protection method. In thismethod, for a process of encryption, decryption, and integrityprotection, refer to descriptions in FIG. 3 and FIG. 4. As shown in FIG.5, the method mainly includes step 501 and step 502.

Step 501: A terminal determines a first parameter.

The first parameter is an input parameter used when the terminalperforms security protection on a NAS message, and the first parameteris used to indicate an access technology used to transmit the NASmessage. The terminal can support at least two access technologies, andcan separately maintain a corresponding NAS COUNT for each of the atleast two access technologies. For example, the at least two accesstechnologies comprise a 3GPP access technology and a different accesstechnology that can share the same 3GPP network core network device withthe 3GPP access technology, for example, a non-3GPP access technology ora fixed network access technology. Optionally, that the first parameterindicates the access technology used to transmit the NAS message may befurther understood to mean that the first parameter is used to indicatea transmission path used by the terminal to transmit the NAS message.For example, the terminal and the AMF node may separately maintain acorresponding NAS COUNT for each transmission path withoutdistinguishing access technologies. If the transmission path used totransmit the NAS message is a path 1, a NAS COUNT corresponding to thepath 1 is used. If the transmission path used to transmit the NASmessage is a path 2, a NAS COUNT corresponding to the path 2 is used. Itmay be understood that a transmission path corresponds to an accesstechnology. For example, referring to FIG. 2, an access technology usedwhen data is transmitted on the path 1 is the 3GPP access technology,and an access technology used when data is transmitted on the path 2 isthe non-3GPP access technology.

The first parameter may be an input parameter newly added in anencryption and decryption process or an integrity protection process.The parameter includes a preset quantity of bits. Optionally, differentaccess technologies may be represented by setting the bits to differentvalues.

In a first possible implementation, as shown in FIG. 6, the firstparameter may be an ACCESS parameter. For example, if the firstparameter is 00, it indicates that the 3GPP access technology is used.If the first parameter is 01, it indicates that the non-3GPP accesstechnology is used. Alternatively, 001 represents the 3GPP accesstechnology, 010 represents a Wi-Fi technology, and 011 represents afixed network technology.

Alternatively, 001 may be used to represent a first used accesstechnology, 010 may be used to represent a second used accesstechnology, and 011 may be used to represent a third used accesstechnology. In other words, each time a used access technology isswitched, the first parameter is increased by 1 until bits of the firstparameter are all 1, and then the first parameter may be recounted from000. For example, if the bits of the first parameter are all changed to1 after the terminal switches a used access technology a plurality oftimes, when the terminal needs to switch the used access technology fromthe first access technology to the second access technology, a firstparameter generated for the second access technology is 001. Optionally,in this method, the first access technology, the second accesstechnology, and the third access technology may be a same technology. Inother words, when an access technology is reused, the first parameter isincreased by 1 until bits of the first parameter are all 1, and then thefirst parameter may be recounted from 000.

Optionally, each time the parameter COUNT in the input parameters isreset to 0 or a NAS Sequence Number is reset to 0, the first parametermay also be increased by 1.

Optionally, when bits of the first parameter are all 1, a NAS key needsto be updated when the NAS key is used the next time a NAS message istransmitted.

In a second possible implementation, as shown in FIG. 7, all or somebits of the parameter COUNT in the input parameters may be used toindicate the access technology used to transmit the NAS message. Forexample, if the COUNT includes 8 all-0 padding bits and a NAS COUNT, thefirst parameter may be some or all bits of the 8 bits. For example, thefirst 3 bits may be selected to indicate the access technology used totransmit the NAS message. For how to distinguish different accesstechnologies using bit values, refer to the related descriptions in thefirst implementation.

In a third possible implementation, as shown in FIG. 8, the parameterBEARER in the input parameters may be used to indicate the accesstechnology used to transmit the NAS message, or to indicate an accesspath used to transmit the NAS message, where the first parameter may bea bit some bits, or all bits of the BEARER. For example, the first 3bits may be selected to indicate the access technology used to transmitthe NAS message. For how to distinguish different access technologiesusing bit values, refer to the related descriptions in the firstimplementation.

In a fourth possible implementation, a quantity of bits of a COUNT maybe increased, and the first parameter comprises some of the bits of theCOUNT. For example, the COUNT is extended from 32 bits to 64 bits (a64-bit COUNT is adapted to a key with a length of 256 bits). A part ofthe extended COUNT is used to indicate an access technology. Forexample, three bits are reserved to indicate an access technology, where000 represents a 3GPP access technology, 001 represents a Wi-Fi accesstechnology, and 010 represents a fixed network access technology.

In a fifth possible implementation, the first parameter may be a NASCOUNT, and a bit of the NAS COUNT may be removed. A quantity of removedbits is used to indicate an access technology.

Optionally, a preset quantity of bits of a NAS overflow in an existingNAS COUNT is removed, and the quantity of the removed bits is used toindicate the access technology. For example, if one bit is removed, itindicates that the access technology is a 3GPP access technology; if twobits are removed, it indicates that the access technology is a Wi-Fiaccess technology; if three bits are removed, it indicates that theaccess technology is a fixed network access technology.

Alternatively, a preset quantity of bits of a Sequence Number part of anexisting NAS COUNT is removed, and the quantity of the removed bits isused to indicate the access technology. For example, if one bit isremoved, it indicates that the access technology is a 3GPP accesstechnology; if two bits are removed, it indicates that the accesstechnology is a Wi-Fi access technology; if three bits are removed, itindicates that the access technology is a fixed network accesstechnology.

Optionally, a first parameter corresponding to each access technologymay be preconfigured in the terminal. After determining the accesstechnology used to transmit the NAS message, the terminal may search fora corresponding first parameter based on the access technology used totransmit the NAS message. Alternatively, after determining the accesstechnology used to transmit the NAS message, the terminal generates thefirst parameter based on the access technology used to transmit the NASmessage.

It should be noted that, when the first parameter is a NAS COUNT or thefirst parameter comprises some bits of a NAS COUNT, the terminalmaintains different NAS COUNTs for different supported accesstechnologies. In other cases, the terminal may maintain a same NAS COUNTor a different NAS COUNT for different supported access technologies.

The terminal may independently determine the first parameter, and notifyan AMF node of the first parameter. Alternatively, an AMF nodedetermines the first parameter, and notifies the terminal of the firstparameter. Alternatively, the first parameter may be preconfigured inthe terminal and an AMF node. For example, if the first parameter isdetermined by the AMF node, the terminal may receive the first parameterfrom the AMF node. If the first parameter comprises some bits in a NASCOUNT, after receiving the first parameter, the terminal may replace,with the first parameter, specified bits in the NAS COUNT stored by theterminal. Alternatively, if the first parameter comprises some bits in aBEARER, the terminal may replace specified bits in the BEARER with thefirst parameter.

Step 502: The terminal performs security protection on a NAS messagebased on the first parameter, a NAS key, and a NAS COUNT correspondingto an access technology used to transmit the NAS message.

The NAS COUNT may be a parameter that has a function of preventing a NASmessage replay attack. The NAS key is a NAS key shared by the at leasttwo access technologies that can be supported by the terminal.

That the terminal performs security protection on a NAS messagecomprises the terminal performing one or more of the following:encrypting a NAS message to be transmitted to a core network device,decrypting a received NAS message, and performing integrity protectionon the NAS message to be transmitted to the core network device, orperforming integrity protection verification on the received NASmessage. Correspondingly, a key used to perform security protection onthe NAS message may be an encryption key and an integrity protectionkey. In this embodiment of this application, the encryption key and theintegrity protection key are collectively referred to as NAS keys. Anexecution sequence of encryption, decryption, production integrityprotection, and integrity protection verification is not limited in thisembodiment of this application.

It may be understood that the terminal can maintain the correspondingNAS COUNT for each of the at least two access technologies. If theterminal transmits the NAS message using the 3GPP access technology,security protection is performed on the NAS message using a firstparameter corresponding to the 3GPP access technology, an uplink NASCOUNT maintained by the terminal for the 3GPP access technology, and theNAS key.

Corresponding to the three implementations of the first parameter,methods for encrypting the NAS message are separately shown in FIG. 6,FIG. 7, and FIG. 8.

Corresponding to the foregoing first implementation, with reference toFIG. 4, an input parameter used when security protection is performed onthe NAS message may also be an ACCESS parameter.

Corresponding to the foregoing second implementation, with reference toFIG. 4, a COUNT in the input parameter used when security protection isperformed on the NAS message includes the first parameter.

Corresponding to the foregoing third implementation, with reference toFIG. 4, a BEARER in the input parameter used when security protection isperformed on the NAS message includes the first parameter.

Optionally, if the terminal receives the NAS message, the terminal maydetermine the first parameter corresponding to the access technologyused to transmit the NAS message, to decrypt and/or perform integrityprotection verification on the NAS message using a downlink NAS COUNTcarried in the NAS message, the first parameter corresponding to theaccess technology used to transmit the NAS message, and the NAS key.

According to the security protection method provided in this embodimentof this application, the terminal can separately maintain thecorresponding NAS COUNT for each of the at least two accesstechnologies. The terminal does not use one set of NAS COUNTS whentransmitting the NAS message using different access technologies.Instead, the terminal performs security protection on the NAS messageusing a NAS COUNT maintained for a corresponding access technology. Thiscan avoid a replay attack problem that occurs when a core network devicefirst receives a relatively small NAS COUNT transmitted using one link,and then receives a relatively large NAS COUNT transmitted using anotherlink. In this application, the first parameter used to differentiatedifferent access technologies is further used when security protectionis performed on the NAS message. Therefore, even though a same NAS keyand a same NAS COUNT are used when security protection is performed on aNAS message transmitted using the different access technologies,security protection results of the NAS message are different, reducing apossibility of occurrence of a replay attack, thereby implementingsecurity protection for a plurality of NAS connection links.

Corresponding to the embodiment in FIG. 5, a method for performingsecurity protection on a NAS message by a core network device is furtherprovided in another implementation of this embodiment of thisapplication. The core network device may be an AMF node, a SEAF node, anMME node, a node participating in an authentication process of aterminal, or another node related to key generation and key storage. Inthis embodiment of this application, that the core network device is anAMF node is used as an example. As shown in FIG. 9, the method includesthe following steps.

Step 901: The AMF node determines a first parameter.

The first parameter is used to indicate an access technology used totransmit a NAS message. The AMF node can separately maintain acorresponding NAS COUNT for each of at least two access technologiessupported by the terminal.

A method for determining the first parameter by the AMF node is similarto the method for determining the first parameter by the terminal instep 501 in FIG. 5, and reference may be made to the related descriptionin step 501.

Step 902: The AMF node performs security protection on a NAS messagebased on the first parameter, a NAS key, and a NAS COUNT correspondingto an access technology used to transmit the NAS message.

The NAS COUNT may be a parameter that has a function of preventing a NASmessage replay attack.

That the AMF node performs security protection on a NAS message maycomprise the AMF node performing one or more of the following:encrypting a NAS message to be transmitted to a terminal, decrypting areceived NAS message, and performing integrity protection on the NASmessage to be transmitted to the terminal, or performing integrityprotection verification on the received NAS message.

A method for performing security protection on the NAS message by theAMF node is similar to the method for performing security protection onthe NAS message by the terminal in step 502. As such, reference may bemade to the related description in step 502.

According to the security protection method provided in this embodimentof this application, the core network device can separately maintain thecorresponding NAS COUNT for each of the at least two accesstechnologies. The terminal does not use one set of NAS COUNTs whentransmitting the NAS message using different access technologies.Instead, the terminal performs security protection on the NAS messageusing a NAS COUNT maintained for a corresponding access technology. Thiscan avoid a replay attack problem that occurs when a core network devicefirst receives a relatively small NAS COUNT transmitted by using onelink, and then receives a relatively large NAS COUNT transmitted usinganother link. In this application, the first parameter used todifferentiate different access technologies is further used whensecurity protection is performed on the NAS message. Therefore, eventhough a same NAS key and a same NAS COUNT are used when securityprotection is performed on a NAS message transmitted using the differentaccess technologies, security protection results of the NAS message aredifferent, thereby reducing a possibility of occurrence of a replayattack, while implementing security protection for a plurality of NASconnection links.

Optionally, if the access technology used to transmit the NAS message isa first access technology, before the procedures in FIG. 5 and FIG. 9,as shown in FIG. 10, the method may further include step 1001 to step1007.

Step 1001: A terminal determines a first uplink NAS COUNT correspondingto the first access technology.

The first uplink NAS COUNT is 0, and further, all or some bits of thefirst uplink NAS COUNT are 0.

Alternatively, the first uplink NAS COUNT is a random number. In someembodiments, some or all bits in the first uplink NAS COUNT are randomnumbers. For example, a Sequence Number part or a NAS overflow part ofthe first uplink NAS COUNT is a random number. In this case, a remainingpart is 0.

Alternatively, the at least two access technologies further include asecond access technology, and the first uplink NAS COUNT is an uplinkNAS COUNT that corresponds to the second access technology and that isstored by the terminal. If the terminal stores at least two uplink NASCOUNTs corresponding to the second access technology, the first uplinkNAS COUNT is a largest uplink NAS COUNT that corresponds to the secondaccess technology and that is stored by the terminal.

Alternatively, the at least two access technologies further include asecond access technology, and the first uplink NAS COUNT is a sum of 1and an uplink NAS COUNT that corresponds to the second access technologyand that is stored by the terminal. If the terminal stores at least twouplink NAS COUNTs corresponding to the second access technology, thefirst uplink NAS COUNT is a sum of 1 and a largest uplink NAS COUNT thatcorresponds to the second access technology and that is stored by theterminal.

Alternatively, the first uplink NAS COUNT is an uplink NAS COUNT thatcorresponds to the first access technology and that is stored by theterminal. If the terminal stores at least two uplink NAS COUNTscorresponding to the first access technology, the first uplink NAS COUNTis a largest uplink NAS COUNT that corresponds to the first accesstechnology and that is stored by the terminal.

Alternatively, the first uplink NAS COUNT is a sum of 1 and an uplinkNAS COUNT that corresponds to the first access technology and that isstored by the terminal. If the terminal stores at least two uplink NASCOUNTs corresponding to the first access technology, the first uplinkNAS COUNT is a sum of 1 and a largest uplink NAS COUNT that correspondsto the first access technology and that is stored by the terminal.

Optionally, the first access technology and the second access technologymay be separately a 3GPP access technology, a non-3GPP accesstechnology, a fixed network access technology, another technology thatcan be used to access a core network device, or any technology that canshare a 3GPP core network device with the 3GPP access technology. Inthis embodiment of this application, an example is described in whichthe first access technology is a non-3GPP access technology and thesecond access technology is a 3GPP access technology.

It may be understood that, before the terminal sends the NAS message toan AMF node via the non-3GPP access technology, the terminal needs todetermine the first uplink NAS COUNT carried when the NAS message istransmitted via the non-3GPP access technology.

If the terminal accesses the AMF node using the non-3GPP accesstechnology for the first time, the first uplink NAS COUNT correspondingto the non-3GPP access technology may be set to 0 or a random number.Alternatively, when the terminal has accessed the AMF node via the 3GPPaccess technology, if a NAS COUNT maintenance method is the method 1described above (i.e., after a NAS message is sent, a NAS COUNT used inthe NAS message is increased by 1 and stored; and when a NAS messageneeds to be sent a next time, security protection is performed on theNAS message using the stored NAS COUNT), it may be determined that thefirst uplink NAS COUNT is an uplink NAS COUNT that corresponds to the3GPP access technology and that is stored by the terminal. If theterminal stores at least two uplink NAS COUNTs corresponding to the 3GPPaccess technology and the terminal cannot determine an uplink NAS COUNTused by a previous NAS message, a largest uplink NAS COUNT thatcorresponds to the 3GPP access technology and that is stored by theterminal is selected, and security protection is performed on the NASmessage. If a NAS COUNT maintenance method is the method 2 describedabove (i.e., after a NAS message is sent, when a NAS message needs to besent a next time, a stored NAS COUNT is increased by 1 to determine anew NAS COUNT, and security protection is performed on the NAS messageusing the new NAS COUNT), it may be determined that the first uplink NASCOUNT is a sum of 1 and an uplink NAS COUNT that corresponds to the 3GPPaccess technology and that is stored by the terminal. If the terminalstores at least two uplink NAS COUNTs corresponding to the 3GPP accesstechnology and the terminal cannot determine an uplink NAS COUNT used bya previous NAS message, a largest uplink NAS COUNT that corresponds tothe 3GPP access technology and that is stored by the terminal isselected and is increased by 1, and security protection is performed onthe NAS message using the uplink NAS COUNT increased by 1.

When the terminal has accessed the AMF node via the non-3GPP accesstechnology, if the NAS COUNT maintenance method is the foregoing method1, it may be determined that the first uplink NAS COUNT is the uplinkNAS COUNT that corresponds to the non-3GPP access technology and that isstored by the terminal. Alternatively, if the NAS COUNT maintenancemethod is the foregoing method 2, it may be determined that the firstuplink NAS COUNT is a sum of 1 and the uplink NAS COUNT that correspondsto the non-3GPP access technology and that is stored by the terminal.

Step 1002: The terminal sends a first message to an AMF node, where thefirst message carries some or all bits of the first uplink NAS COUNT.

Security protection is performed on the first message using the firstuplink NAS COUNT and a NAS key. Optionally, the first message may carrya 24-bit first uplink COUNT, or may carry only some bits of the firstuplink COUNT, for example, carry only last 4 or 8 bits of the firstuplink NAS COUNT.

In another possible implementation, if the terminal accesses, for thefirst time, the AMF node via the non-3GPP access technology, and theterminal has accessed the AMF node via the 3GPP access technology, theterminal may temporarily not determine the first uplink NAS COUNT, andperform security protection firstly on the first message using a NASCOUNT corresponding to the non-3GPP access technology. In other words,step 1001 and step 1002 may be replaced with step 1003.

Step 1003: The terminal sends a first message to an AMF node, where thefirst message carries some or all bits of an uplink NAS COUNTcorresponding to a second access technology.

Security protection is performed on the first message using the NAS keyand the uplink NAS COUNT corresponding to the second access technology.

The uplink NAS COUNT that corresponds to the second access technologyand is carried in the first message may comprise some or all bits of theuplink NAS COUNT that corresponds to the second access technology andthat is stored by the terminal. Alternatively, the uplink NAS COUNT maycomprise some or all bits of a new uplink NAS COUNT obtained after theuplink NAS COUNT that corresponds to the second access technology andthat is stored by the terminal is increased by 1. If the terminal storesat least two uplink NAS COUNTS corresponding to the second accesstechnology, the uplink NAS COUNT corresponding to the second accesstechnology in this step is a largest uplink NAS COUNT that correspondsto the second access technology and that is stored by the terminal.

Optionally, the first message in step 1002 and that in step 1003 bothinclude first indication information, where the first indicationinformation is used to indicate an access technology corresponding tosome or all bits of the uplink NAS COUNT carried in the first message.Alternatively, the first indication information is used to indicate atransmission path corresponding to some or all bits of the NAS COUNTcarried in the first message. For example, the first indicationinformation carried in the first message in step 1002 indicates thenon-3GPP access technology, and the first indication information carriedin the first message in step 1003 indicates the 3GPP access technology.For another example, the first indication information carried in thefirst message in step 1002 indicates accessing the AMF node via a path1, and the first indication information carried in the first message instep 1003 indicates accessing the AMF node via a path 2.

The following steps may be further performed after step 1002 or step1003.

Step 1004: The AMF node receives the first message.

Step 1005: The AMF node verifies, based on an uplink NAS COUNTcorresponding to an access technology indicated by first indicationinformation, a NAS COUNT carried in the first message.

Indication information may be an explicit indication or an implicitnotification. For example, access type information may comprise accesstype indication information (such as an access type of a radio accesstechnology (RAT) type) that is explicitly indicated in an N2 message.Alternatively, access type information may comprise access typeindication information that is added in the NAS message. The AMF nodemay determine an access type based on a source of the first message whenthere is no access type indication information. For example, if a sourceaddress of the message is a base station, an access type is 3GPP access;if a source address of the message is an N3IWF node, an access type isnon-3GPP access; if a source address of the message is a deviceconnected to a fixed network, an access type is fixed network access.

When the first indication information indicates the non-3GPP accesstechnology, if the first message carries a complete first NAS COUNT andthe AMF node determines that the terminal has accessed the AMF node, theAMF node determines whether the first NAS COUNT is greater than apreviously received uplink NAS COUNT that corresponds to the non-3GPPaccess technology and that is stored by the AMF node. If the first NASCOUNT is greater than the previously received uplink NAS COUNT, theverification succeeds. However, if the first NAS COUNT is less than thepreviously received uplink NAS COUNT, the authentication fails, in whichcase access of the terminal is rejected and the terminal is informed ofa failure reason. Optionally, if the AMF node determines that theterminal has not accessed the AMF node using the non-3GPP accesstechnology, the AMF node stores the first NAS COUNT as the uplink NASCOUNT corresponding to the non-3GPP access technology, or the AMF nodedetermines that the uplink NAS COUNT corresponding to the non-3GPPaccess technology is 0. If the first message carries a part of the firstNAS COUNT, the AMF node first recovers the complete first NAS COUNT, andthen verifies or saves the first NAS COUNT according to the foregoingmethod for processing the first NAS COUNT.

When the first indication information indicates the 3GPP accesstechnology, if the first message carries a complete NAS COUNTcorresponding to the 3GPP access technology, the AMF node determineswhether the first NAS COUNT is greater than a previously received uplinkNAS COUNT that corresponds to the 3GPP access technology and that isstored by the AMF node. If the first NAS COUNT is greater than thepreviously received uplink NAS COUNT, the verification succeeds.However, if the first NAS COUNT is less than the previously receiveduplink NAS COUNT, the authentication fails. If the first message carriesa part of a NAS COUNT corresponding to the 3GPP access technology, theAMF node first recovers the complete NAS COUNT, and then verifies therecovered complete COUNT using the foregoing method for verifying theNAS COUNT.

Step 1006: The AMF node determines one or both of a second uplink NASCOUNT and a first downlink NAS COUNT that correspond to the first accesstechnology.

The second uplink NAS COUNT is 0, and further, all or some bits of thesecond uplink NAS COUNT are 0. Alternatively, the second uplink NASCOUNT is a random number. In some embodiments, some or all bits in thesecond uplink NAS COUNT are random numbers. For example, a SequenceNumber part or a NAS overflow part of the second uplink NAS COUNT is arandom number. In this case, a remaining part is 0. Alternatively, thesecond uplink NAS COUNT is a downlink NAS COUNT that corresponds to thesecond access technology and that is stored by the core network device.If the core network device stores at least two downlink NAS COUNTscorresponding to the second access technology, the second uplink NASCOUNT is a largest downlink NAS COUNT that corresponds to the secondaccess technology and that is stored by the core network device.Alternatively, the second uplink NAS COUNT is a sum of 1 and a downlinkNAS COUNT that corresponds to the second access technology and that isstored by the core network device. If the core network device stores atleast two downlink NAS COUNTs corresponding to the second accesstechnology, the second uplink NAS COUNT is a sum of 1 and a largestdownlink NAS COUNT that corresponds to the second access technology andthat is stored by the core network device. Alternatively, the seconduplink NAS COUNT is a sum of 1 and a downlink NAS COUNT that correspondsto the first access technology and that is stored by the core networkdevice. If the core network device stores at least two downlink NASCOUNTs corresponding to the first access technology, the second uplinkNAS COUNT is a sum of 1 and a largest downlink NAS COUNT thatcorresponds to the first access technology and that is stored by thecore network device. Alternatively, the second uplink NAS COUNT is thefirst uplink NAS COUNT; or the second uplink NAS COUNT is a sum of 1 andthe first uplink NAS COUNT.

Optionally, if the first message received by the AMF node carries thefirst uplink NAS COUNT, the AMF node may determine that the seconduplink NAS COUNT is the first uplink NAS COUNT, or that the seconduplink NAS COUNT is a sum of 1 and the first uplink NAS COUNT.

Alternatively, if the first message received by the AMF node carries thefirst uplink NAS COUNT, it indicates that the terminal has determinedthe NAS COUNT corresponding to the non-3GPP access technology, and theAMF node may not determine a second NAS COUNT.

The first downlink NAS COUNT is 0, and further, all or some bits of thefirst downlink NAS COUNT are 0.

Alternatively, the first downlink NAS COUNT is a random number. In someembodiments, some or all bits in the first downlink NAS COUNT are randomnumbers. For example, a Sequence Number part or a NAS overflow part ofthe first uplink NAS COUNT is a random number. In this case, a remainingpart is 0. Alternatively, the first downlink NAS COUNT is a downlink NASCOUNT that corresponds to the second access technology and that isstored by the core network device. If the core network device stores atleast two downlink NAS COUNTs corresponding to the second accesstechnology, the first downlink NAS COUNT is a largest downlink NAS COUNTthat corresponds to the second access technology and that is stored bythe core network device. Alternatively, the first downlink NAS COUNT isa sum of 1 and a downlink NAS COUNT that corresponds to the secondaccess technology and that is stored by the core network device. If thecore network device stores at least two downlink NAS COUNTscorresponding to the second access technology, the first downlink NASCOUNT is a sum of 1 and a largest downlink NAS COUNT that corresponds tothe second access technology and that is stored by the core networkdevice. Alternatively, the first downlink NAS COUNT is a sum of 1 and adownlink NAS COUNT that corresponds to the first access technology andthat is stored by the core network device. If the core network devicestores at least two downlink NAS COUNTs corresponding to the firstaccess technology, the first downlink NAS COUNT is a sum of 1 and alargest downlink NAS COUNT that corresponds to the first accesstechnology and that is stored by the core network device.

Optionally, if the first message received by the AMF node carries theNAS COUNT corresponding to the second access technology, the seconduplink NAS COUNT determined by the AMF node may be the same as the firstdownlink NAS COUNT.

Step 1007: The AMF node sends a second message to the terminal, wherethe second message includes one or both of the second uplink NAS COUNTand the first downlink NAS COUNT that correspond to the first accesstechnology.

Correspondingly, the terminal receives the second message.

Optionally, the second message carries second indication information,and the second indication information is used to indicate an accesstechnology corresponding to the first downlink NAS COUNT carried in thesecond message. Optionally, the second message may further carryindication information used to indicate the second uplink NAS COUNTcarried in the second message. Optionally, the second indicationinformation is used to indicate a transmission path corresponding to thefirst downlink NAS COUNT carried in the second message. Optionally, thesecond message may further carry indication information that is used toindicate a transmission path corresponding to the second uplink NASCOUNT carried in the second message. It may be understood that, becausethe second message carries the first downlink NAS COUNT corresponding tothe first access technology, the second indication information is usedto indicate the first access technology. For example, if the firstaccess technology is the 3GPP access technology, the second indicationinformation is used to indicate the 3GPP access technology; if the firstaccess technology is the non-3GPP access technology, the secondindication information is used to indicate the non-3GPP accesstechnology.

It may be understood that, after receiving the second message, theterminal may save one or both of the second uplink NAS COUNT and thefirst downlink NAS COUNT that are carried in the second message. Whenthe next time an uplink NAS message needs to be sent via the non-3GPP,security protection may be performed on the NAS message based on thesecond uplink NAS COUNT. Alternatively, after receiving a downlink NASmessage, a downlink NAS COUNT in the received downlink NAS message maybe verified based on the first downlink NAS COUNT.

With reference to an example scenario, the following describes thesecurity protection method described in the foregoing embodiments. Anembodiment of this application may be applied to a scenario in which aterminal has accessed an AMF node using a 3GPP access technology, andthen the terminal accesses the same AMF node using a non-3GPP accesstechnology. FIG. 11A and FIG. 11B show a registration process in whichthe terminal accesses the AMF node using the non-3GPP access technology.The method includes the following steps.

Step 1101: The terminal accesses an untrusted non-3GPP network.

For example, the terminal accesses a Wi-Fi network that cannot bedirectly trusted.

In this step, the terminal accesses the untrusted non-3GPP network, andthe terminal has been authenticated by a 3GPP network and has a NASsecurity context. The NAS security context includes a NAS key, a keyidentifier, and a NAS COUNT corresponding to the 3GPP access technology.Optionally, the NAS context further includes a NAS COUNT correspondingto the non-3GPP access technology. If the terminal has accessed the AMFnode via the non-3GPP access technology, the NAS COUNT corresponding tothe non-3GPP access technology is not 0. If the terminal has notaccessed the AMF node via the non-3GPP access technology, the NAS COUNTcorresponding to the non-3GPP access technology is 0.

The NAS key may be one or both of an encryption key and an integrityprotection key.

Step 1102: The terminal exchanges an Internet Key Exchange Protocolsecurity association initial (IKE_SA_INIT) message with an N3IWF node.

The IKE_SA_INIT message carries a key material, and the key material isinformation used to perform security protection on a message transmittedbetween the terminal and the N3IWF node. After the terminal exchangesthe IKE_SA_INIT message with the N3IWF node, the terminal and the N3IWFnode may generate a same key, and the key is used to perform securityprotection on a message subsequently transmitted by the terminal and theN3IWF node.

Step 1103: The terminal sends an Internet Key Exchange Protocolauthentication request (IKE_AUTH_Req) message to the N3IWF node.

Correspondingly, the N3IWF node receives the IKE_AUTH_Req message.

Step 1104: The N3IWF node sends an Internet Key Exchange Protocolauthentication response (IKE_AUTH_Res) message to the terminal.

Correspondingly, the terminal receives the IKE_AUTH_Res message.

The IKE_AUTH_Res message carries a 5G start message of an ExtensibleAuthentication Protocol 5th Generation request (EAP_5G_Req) message, andthe EAP_5G_Req message is used to request the terminal to start anExtensible Authentication Protocol (EAP) procedure.

Step 1105: The terminal determines a first uplink NAS COUNT.

The first uplink NAS COUNT is a COUNT used to perform securityprotection on the NAS message sent by the terminal to the AMF node.

There are two implementations of this step.

In a first implementation, the terminal determines the first uplink NASCOUNT based on an uplink NAS COUNT corresponding to the 3GPP accesstechnology.

Because the terminal has accessed the AMF node via the 3GPP accesstechnology, the terminal has stored a NAS COUNT corresponding to the3GPP access technology. If a NAS COUNT maintenance method is theforegoing method 1, it can be determined that the first uplink NAS COUNTis the uplink NAS COUNT that corresponds to the 3GPP access technologyand that is stored by the terminal (if the terminal stores at least twouplink NAS COUNTs corresponding to the 3GPP access technology, the firstuplink NAS COUNT is a largest uplink NAS COUNT that corresponds to the3GPP access technology and that is stored by the terminal). If a NASCOUNT maintenance method is the foregoing method 2, it can be determinedthat the first uplink NAS COUNT is a sum of 1 and an uplink NAS COUNTthat corresponds to the non-3GPP access technology and that is stored bythe terminal (if the terminal stores at least two uplink NAS COUNTscorresponding to the non-3GPP access technology, the first uplink NASCOUNT is a sum of 1 and a largest uplink NAS COUNT that corresponds tothe non-3GPP access technology and that is stored by the terminal).

In a second implementation, the terminal generates a NAS COUNTcorresponding to the non-3GPP access technology, and uses, as the firstuplink NAS COUNT, the NAS COUNT corresponding to the non-3GPP accesstechnology.

In some embodiments, the first uplink NAS COUNT may be 0, or may be arandom number.

If the first uplink NAS COUNT is 0, all or some bits of the first uplinkNAS COUNT are 0. If the first uplink NAS COUNT is a random number, someor all bits in the first uplink NAS COUNT are random numbers. Forexample, last 8 bits (a Sequence Number part) of the first uplink NASCOUNT are random numbers, or a NAS overflow part is a random number, anda remaining part is 0.

Optionally, if the terminal has accessed the AMF node via the non-3GPPaccess technology, the terminal may determine that the first uplink NASCOUNT is the uplink NAS COUNT that corresponds to the non-3GPP accesstechnology and that is stored by the terminal (if the terminal stores atleast two uplink NAS COUNTs corresponding to the non-3GPP accesstechnology, the first uplink NAS COUNT is a largest uplink NAS COUNTthat corresponds to the non-3GPP access technology and that is stored bythe terminal), or the terminal may determine that the first uplink NASCOUNT is a sum of 1 and a NAS COUNT that corresponds to the non-3GPPaccess technology and that is stored by the terminal (if the terminalstores at least two uplink NAS COUNTs corresponding to the non-3GPPaccess technology, the first uplink NAS COUNT is a sum of 1 and alargest uplink NAS COUNT that corresponds to the non-3GPP accesstechnology and that is stored by the terminal).

Optionally, if the first uplink NAS COUNT is determined in the secondimplementation, in a registration process in which the terminal accessesthe AMF node using the non-3GPP access technology, the terminal does notsend a NAS message using the 3GPP access technology.

Optionally, the terminal may further set an indicator. The indicator isequivalent to the first indication information in the embodimentcorresponding to FIG. 10, and is used to indicate whether the firstuplink NAS COUNT corresponds to the 3GPP access technology or thenon-3GPP access technology. It may be understood that, if the terminaldetermines the first uplink NAS COUNT in the foregoing firstimplementation, the indicator indicates the 3GPP access technology; orif the terminal determines the first uplink NAS COUNT in the foregoingsecond implementation, the indicator indicates the non-3GPP accesstechnology.

Step 1106: The terminal sends an IKE_AUTH_Req message to the N3IWF node.

Correspondingly, the N3IWF node receives the IKE_AUTH_Req message.

The IKE_AUTH_Req message includes a NAS protocol data unit (PDU) and anExtensible Authentication Protocol for transporting 5G non-accessstratum message (a 5G-NAS message corresponding to an EAP_5G_ReSmessage), or a 5G-NAS message. The NAS PDU includes a registrationrequest message. The registration request message is used by theterminal to register with the AMF node via the 3GPP access technology.Optionally, the first message in the foregoing embodiment may be theregistration request message.

Optionally, integrity protection may be performed on the registrationrequest message using the first uplink NAS COUNT, and the registrationrequest message includes the first indication information and the firstuplink NAS COUNT. Optionally, the registration request message furtherincludes the key identifier and a temporary identifier of the terminal.

Step 1107: The N3IWF node selects an AMF node.

For a method for selecting the AMF node by the N3IWF node, refer toconventional approaches.

Step 1108: The N3IWF node forwards a registration request message to theAMF node.

Correspondingly, the AMF node receives the registration request message.

Step 1109: The AMF node verifies the registration request message.

The verification performed on the registration request message by theAMF node includes integrity protection verification performed on theregistration request message and verification performed on the firstuplink NAS COUNT carried in the registration request message. That theAMF node verifies the first uplink NAS COUNT carried in the registrationrequest message corresponds to the foregoing step 1005.

The AMF node may generate an integrity protection key based on thetemporary identifier and the key identifier in the registration requestmessage, and perform integrity protection verification on theregistration request message based on the integrity protection key.

If the access technology that corresponds to the first uplink NASmessage and that is indicated by the first indication information is the3GPP access technology, the AMF node verifies whether the first uplinkNAS COUNT is greater than a previously received NAS COUNT correspondingto the 3GPP access technology. If the first uplink NAS COUNT is greaterthan the previously received NAS COUNT, the verification succeeds; or ifthe first uplink NAS COUNT is not greater than the previously receivedNAS COUNT, the verification fails.

If the access technology that corresponds to the first uplink NASmessage and that is indicated by the first indication information is thenon-3GPP access technology, and the terminal has not accessed the AMFnode via the non-3GPP access technology, the AMF node stores the firstNAS COUNT as the uplink NAS COUNT corresponding to the non-3GPP accesstechnology, or the AMF node determines that the uplink NAS COUNTcorresponding to the non-3GPP access technology is 0. The terminal hasaccessed the AMF node via the non-3GPP access technology. The AMF nodeverifies whether the first uplink NAS COUNT is greater than a previouslyreceived NAS COUNT corresponding to the non-3GPP access technology. Ifthe first uplink NAS COUNT is greater than the previously received NASCOUNT, the verification succeeds; or if the first uplink NAS COUNT isnot greater than the previously received NAS COUNT, the verificationfails.

Step 1110: The AMF node generates a key Kn3iwf for the N3IWF node.

The key Kn3iwf is used for two-way authentication between the AMF nodeand the terminal.

Step 1111: The AMF node determines one or both of a second uplink NASCOUNT and a first downlink NAS COUNT that are corresponding to thenon-3GPP access technology.

Optionally, if the access technology indicated by the first indicationinformation is the 3GPP access technology, it indicates that theterminal does not determine the NAS COUNT for the non-3GPP accesstechnology, and the AMF node may determine the second uplink NAS COUNTand the first downlink NAS COUNT that are corresponding to the non-3GPPaccess technology. If the access technology indicated by the firstindication information is the non-3GPP access technology, it indicatesthat the terminal determines the uplink NAS COUNT for the non-3GPPaccess technology, and the AMF node needs to determine only the firstdownlink NAS COUNT corresponding to the non-3GPP technology, or the AMFnode determines the first downlink NAS COUNT and redetermines the uplinkNAS COUNT of the non-3GPP access technology.

In some embodiments, the second uplink NAS COUNT is 0, or the seconduplink NAS COUNT is a random number.

If the second uplink NAS COUNT is 0, all or some bits of the seconduplink NAS COUNT are 0. If the second uplink NAS COUNT is a randomnumber, some or all bits in the second uplink NAS COUNT are randomnumbers. For example, last 8 bits (a Sequence Number part) of the seconduplink NAS COUNT are random numbers, or a NAS overflow part is a randomnumber, and a remaining part is 0. Optionally, if the second uplink NASCOUNT is a random number, the second uplink NAS COUNT needs to begreater than a downlink NAS COUNT that corresponds to the 3GPP accesstechnology and that is stored by the AMF node (if the AMF node stores atleast two downlink NAS COUNTs corresponding to the 3GPP accesstechnology, the second uplink NAS COUNT needs to be greater than alargest downlink NAS COUNT that corresponds to the 3GPP accesstechnology and that is stored by the AMF node).

The second uplink NAS COUNT may be a downlink NAS COUNT that correspondsto the 3GPP access technology and that is stored by the AMF node (if theAMF node stores at least two downlink NAS COUNTs corresponding to the3GPP access technology, the second uplink NAS COUNT is a largestdownlink NAS COUNT that corresponds to the 3GPP access technology andthat is stored by the terminal). Alternatively, the second uplink NASCOUNT is a sum of 1 and a downlink NAS COUNT that corresponds to the3GPP access technology and that is stored by the AMF node (if the AMFnode stores at least two downlink NAS COUNTs corresponding to the 3GPPaccess technology, the second uplink NAS COUNT is a sum of 1 and alargest downlink NAS COUNT that corresponds to the 3GPP accesstechnology and that is stored by the terminal). Alternatively, thesecond uplink NAS COUNT may be a sum of 1 and a downlink NAS COUNT thatcorresponds to the non-3GPP access technology and that is stored by theAMF node (if the AMF node stores at least two downlink NAS COUNTscorresponding to the non-3GPP access technology, the second uplink NASCOUNT is a sum of 1 and a largest downlink NAS COUNT that corresponds tothe non-3GPP access technology and that is stored by the terminal).Alternatively, the second uplink NAS COUNT is the first uplink NASCOUNT; or the second uplink NAS COUNT is a sum of 1 and the first uplinkNAS COUNT.

Optionally, the first downlink NAS COUNT may be the same as the seconduplink NAS COUNT.

In some embodiments, the first downlink NAS COUNT may be 0, or may be arandom number.

If the first downlink NAS COUNT is 0, all or some bits of the firstdownlink NAS COUNT are 0. If the first downlink NAS COUNT is a randomnumber, some or all bits in the first downlink NAS COUNT are randomnumbers. For example, last 8 bits (a Sequence Number part) of the firstdownlink NAS COUNT are random numbers, or a NAS overflow part is arandom number, and a remaining part is 0. Optionally, if the firstdownlink NAS COUNT is a random number, the first downlink NAS COUNTneeds to be greater than a largest downlink NAS COUNT that correspondsto the 3GPP access technology and that is stored by the AMF node.

Alternatively, the first downlink NAS COUNT may be a downlink NAS COUNTthat corresponds to the 3GPP access technology and that is stored by theAMF node (if the AMF node stores at least two downlink NAS COUNTscorresponding to the 3GPP access technology, the first downlink NASCOUNT may further be a largest downlink NAS COUNT that corresponds tothe 3GPP access technology and that is stored by the AMF node).Alternatively, the first downlink NAS COUNT may be a sum of 1 and adownlink NAS COUNT that corresponds to the 3GPP access technology andthat is stored by the AMF node (if the AMF node stores at least twodownlink NAS COUNTs corresponding to the 3GPP access technology, thefirst downlink NAS COUNT may further be a sum of 1 and a largestdownlink NAS COUNT that corresponds to the 3GPP access technology andthat is stored by the AMF node). Alternatively, the first downlink NASCOUNT may be a sum of 1 and a downlink NAS COUNT that corresponds to thenon-3GPP access technology and that is stored by the AMF node (if theAMF node stores at least two downlink NAS COUNT corresponding to thenon-3GPP access technology, the first downlink NAS COUNT may further bea sum of 1 and a largest downlink NAS COUNT that corresponds to thenon-3GPP access technology and that is stored by the AMF node).

It should be noted that the AMF node may store one or both of thegenerated second uplink NAS COUNT and the generated first downlink NASCOUNT. The AMF node may maintain an uplink NAS COUNT and a downlink NASCOUNT that are corresponding to the 3GPP access technology, and mayfurther maintain an uplink NAS COUNT and a downlink NAS COUNT that arecorresponding to the non-3GPP access technology. If the AMF nodegenerates the second uplink NAS COUNT and the first downlink NAS COUNT,the AMF node stores the second uplink NAS COUNT and the first downlinkNAS COUNT. If the AMF node generates only the first downlink NAS COUNT,the AMF node stores the first downlink NAS COUNT. In this case, theuplink NAS COUNT that corresponds to the non-3GPP access technology andthat is maintained by the terminal is the first uplink NAS COUNT.

It may be understood that the AMF node separately maintains a set of NASCOUNTs for each of the 3GPP access technology and the non-3GPP accesstechnology, in other words, magnitudes of the NAS COUNTs maintained bythe AMF node for the 3GPP access technology and magnitudes of the NASCOUNTs maintained by the AMF node for the non-3GPP access technology donot affect each other. When receiving the uplink NAS message, the AMFnode may determine, based on bit information in the uplink NAS messageor information in an N2 message, an access technology or a transmissionpath used by the terminal to transmit the uplink NAS message. If theused access technology is the 3GPP access technology, the uplink NASCOUNT carried in the uplink NAS message may be compared with a largestuplink NAS COUNT maintained for the 3GPP access technology. If the usedaccess technology is the non-3GPP access technology, the uplink NASCOUNT carried in the uplink NAS message may be compared with a largestuplink NAS COUNT maintained for the non-3GPP access technology, toprevent a replay attack.

Step 1112: The AMF node sends a NAS security mode command (SMC) messageto the terminal using the N3IWF node.

Correspondingly, the terminal receives the NAS SMC message.

The second message in the foregoing embodiment may be the NAS SMCmessage.

The NAS SMC message carries one or both of the second uplink NAS COUNTand the first downlink NAS COUNT. It may be understood that if the AMFnode determines only the first downlink NAS COUNT, the NAS SMC messagecarries the first downlink NAS COUNT. If the AMF node determines thesecond uplink NAS COUNT and the first downlink NAS COUNT, the NAS SMCmessage carries the second uplink NAS COUNT and the first downlink NASCOUNT.

Optionally, if the NAS message carries only the first downlink NASCOUNT, the NAS message may further carry indication information used toinstruct the terminal to continue using the uplink NAS COUNT determinedby the terminal.

Optionally, the NAS SMC message further includes second indicationinformation, and the second indication information is used to indicatean access technology or a transmission path corresponding to the NASCOUNT carried in the NAS SMC message. In a scenario of this embodiment,the access technology indicated by the second indication information isthe non-3GPP access technology.

Step 1113: The terminal determines, based on the NAS SMC message, anuplink NAS COUNT and a downlink NAS COUNT that are corresponding to thenon-3GPP access technology.

The terminal may separately maintain a set of NAS COUNTs for each of the3GPP access technology and the non-3GPP access technology. In a scenarioof this embodiment, the terminal has stored the uplink NAS COUNT and thedownlink NAS COUNT that are corresponding to the 3GPP access technology,and the terminal may further determine, based on the NAS SMC messagereceived in this step, an uplink NAS COUNT and a downlink NAS COUNT thatare maintained for the non-3GPP.

Optionally, if the NAS SMC message includes only the first downlink NASCOUNT, the terminal determines that the uplink NAS COUNT correspondingto the non-3GPP access technology is still the first uplink NAS COUNT,and the downlink NAS COUNT corresponding to the non-3GPP accesstechnology is the first downlink NAS COUNT. If the NAS SMC messageincludes the second uplink NAS COUNT and the first downlink NAS COUNT,the terminal may determine that the uplink NAS COUNT corresponding tothe non-3GPP access technology is the second uplink NAS COUNT, and thedownlink NAS COUNT corresponding to the non-3GPP access technology isthe first downlink NAS COUNT.

It may be understood that when receiving a downlink NAS message, theterminal may determine, based on bit information in the downlink NASmessage, an access technology or a transmission path used by theterminal to transmit the downlink NAS message. If the used accesstechnology is the 3GPP access technology, a downlink NAS COUNT carriedin the downlink NAS message may be compared with the largest downlinkNAS COUNT maintained for the 3GPP access technology. If the used accesstechnology is the non-3GPP access technology, a downlink NAS COUNTcarried in the downlink NAS message may be compared with the largestdownlink NAS COUNT maintained for the non-3GPP access technology, toprevent a replay attack.

Step 1114: The terminal sends a NAS security mode complete (SMP) messageto the AMF node using the N3IWF node.

Correspondingly, the AMF node receives the NAS SMP message.

Optionally, the NAS message in step 502 may be the NAS SMP message inthis step.

The terminal may perform integrity protection on the NAS SMP messageusing the first parameter, the uplink NAS COUNT, and the NAS key. Thefirst parameter is used to indicate that an access technology used totransmit the NAS SMP message is the non-3GPP access technology.Alternatively, the first parameter is used to indicate that atransmission path used to transmit the NAS SMP message is the path 2 inFIG. 2. The uplink NAS COUNT is the uplink NAS COUNT that corresponds tothe non-3GPP access technology and that is determined by the terminal instep 1113, or an uplink NAS COUNT corresponding to the path 2. The NASSMP message carries the uplink NAS COUNT.

After receiving the NAS SMP message, the AMF node may verify whether theuplink NAS COUNT carried in the NAS SMP message is greater than theuplink NAS COUNT that corresponds to the non-3GPP access technology andthat is stored by the AMF node. Alternatively, the AMF node may verifywhether the uplink NAS COUNT carried in the NAS SMP message is greaterthan the uplink NAS COUNT corresponding to the path 2. If the uplink NASCOUNT carried in the NAS SMP message is greater than the uplink NASCOUNT that corresponds to the non-3GPP access technology and that isstored by the AMF node, or if the uplink NAS COUNT carried in the NASSMP message is greater than the uplink NAS COUNT corresponding to thepath 2, it may be determined, based on the bit information in the NASmessage, that the access technology used to transmit the NAS SMP messageis the non-3GPP access technology, to determine the first parametercorresponding to the non-3GPP access technology. The AMF node may thenperform integrity verification on the NAS SMP message based on the firstparameter, the NAS key, and the uplink NAS COUNT carried in the NAS SMPmessage. If the verification succeeds, step 1115 is performed.Optionally, if the AMF stores a plurality of uplink NAS COUNTS, it maybe verified whether the uplink NAS COUNT carried in the NAS SMP messageis greater than the largest uplink NAS COUNT that corresponds to thenon-3GPP access technology and that is stored by the AMF node.

Step 1115: The AMF node sends an N2 message to the N3IWF node. The N2message carries a key Kn3iwf and a registration complete message.

Correspondingly, the N3IWF node receives the N2 message.

Step 1116: The N3IWF node sends an EAP-5G-Success message to theterminal.

Correspondingly, the terminal receives the EAP-5G-Success message.

Step 1117: The terminal and the N3IWF node complete calculation of anauthentication parameter using the Kn3iwf.

Step 1118: An Internet Protocol (IP) Security (IPsec) connection isestablished between the terminal and the N3IWF node.

Step 1119: The N3IWF node sends a registration complete message to theterminal.

According to the method provided in this embodiment of this application,the terminal can access a network via the non-3GPP access technology,and can independently maintain the NAS COUNT of the 3GPP accesstechnology and the NAS COUNT of the non-3GPP access technology, therebyreducing a possibility of occurrence of a replay attack.

In a possible implementation of this embodiment of this application, asecurity context of the terminal may be bound to operator information.For example, the operator information may be a PLMN ID. After theterminal accesses a network using a 3GPP access technology provided byan operator A, when the terminal executes the procedure corresponding toFIG. 11A and FIG. 11B, it may be determined whether the N3IWF nodecorresponding to the non-3GPP access technology is still the operator A.If the N3IWF node is still the operator A, the procedure correspondingto FIG. 11A and FIG. 11B may be continued.

In another possible implementation, a security context of the terminalon a non-3GPP access technology side may be bound to other informationsuch as subscription information and location area information. Forexample, the terminal moves from a coverage range of a base station A toa coverage range of a base station B, the coverage range of the basestation A supports a non-3GPP access technology C, and the base stationB supports a non-3GPP access technology D. If the terminal accesses thenetwork via the non-3GPP access technology C, when the terminal movesfrom the coverage range of the base station A to the coverage range ofthe base station B, if subscription information of the terminalindicates that the terminal does not have permission for using thenon-3GPP access technology D, the terminal cannot access the network viathe non-3GPP access technology D.

Optionally, in the foregoing embodiment, the AMF node may determine,based on the first indication information, an access technology used totransmit a NAS message. This embodiment of this application furtherprovides three methods for determining an access technology used totransmit an N2 message or a NAS message after an AMF node receives theN2 message.

Method 1: The AMF node may determine, based on a source of the N2message, the access technology used to transmit the N2 message. Forexample, the AMF node determines the source of the message based onsource address information (for example, an IP address), and furtherdetermines, based on the source of the message, the access technologyused to transmit the message. If the N2 message comes from a device viaa 3GPP access technology, for example, a base station, it is determinedthat a NAS COUNT corresponding to the 3GPP access technology can beused. In other words, the AMF node may verify, using an uplink NAS COUNTthat corresponds to the 3GPP access technology and that is stored by theAMF node, an uplink NAS COUNT carried in the N2 message. If the N2message comes from a device via a non-3GPP access technology, forexample, an N3IWF node, it is determined that a NAS COUNT correspondingto the non-3GPP access technology may be used. In other words, the AMFnode may verify, using an uplink NAS COUNT that corresponds to thenon-3GPP access technology and that is stored by the AMF node, an uplinkNAS COUNT carried in the N2 message.

Method 2: The terminal may notify the AMF node of a source of the N2message in an explicit manner. For example, the N2 message may carry abit that is used to indicate an access technology. For example, 0represents a 3GPP access technology, and 1 represents a non-3GPP accesstechnology. Alternatively, the N2 message may carry a character string,for example, “NR” represents a 3GPP access technology, and “wi-fi”represents a non-3GPP access technology.

Method 3: The AMF node determines, based on access type information inthe N2 message, the access technology used to transmit the N2 message.For example, the access type information comprises RAT type (an accesstype) information. If the N2 message comes from a device using a 3GPPaccess technology, for example, a base station, an access typeindication in the N2 message is 3GPP access, such that it is determinedthat a NAS COUNT corresponding to the 3GPP access technology may beused. In other words, the AMF node may verify, using an uplink NAS COUNTthat corresponds to the 3GPP access technology and that is stored by theAMF node, an uplink NAS COUNT carried in the N2 message.

In comparison with other approaches in which the AMF node does notdistinguish access technologies used by received messages, in theforegoing two manners in this embodiment of this application, the AMFnode may determine an access technology used by a received message, toselect a NAS COUNT corresponding to the access technology used by thereceived message.

Optionally, in another implementation provided in this embodiment ofthis application, with reference to the method procedure correspondingto FIG. 11A and FIG. 11B, if the AMF node determines the second uplinkNAS COUNT and the first downlink NAS COUNT that correspond to thenon-3GPP access technology in step 1111, the AMF node may further updatethe NAS key. This embodiment of this application provides four methodsfor updating the NAS key.

Method 1: Generate new Kamf (nKamf) using old Kamf (oKamf), and afterthe AMF node generates nKamf, generate a new NAS key based on nKamf.

Herein, Kamf is a root key of the AMF node.

Herein, nKamf=KDF (oKamf, a freshness parameter). The freshnessparameter may be an uplink NAS COUNT previously received by the AMFnode, a COUNT, a parameter sent by the terminal to the AMF node, or aparameter that is negotiated between the terminal and the AMF node.

Method 2: Generate nKamf using Kseaf, and after the AMF node generatesnKamf, generate a new NAS key based on nKamf.

Herein, Kseaf is a root key of the AMF node.

Herein, nKamf=KDF (Kamf, a freshness parameter). The freshness parametermay be an uplink NAS COUNT previously received by the AMF node, or maybe a COUNTer value. For example, a start value of the COUNTer value is0, and each time the AMF node generates a NAS key, the COUNTer value isincreased by 1, to indicate that the AMF node generates a new key.

Method 3: The AMF node may generate a new NAS key based on old Kamf(oKamf) and an algorithm.

Herein, nKamf=KDF (oKamf, an algorithm ID, a selected algorithm, andanother parameter), and the algorithm ID is an identifier of analgorithm selected by the AMF node. The selected algorithm is analgorithm used by the terminal and the AMF node to perform securityprotection on a NAS message.

The other parameter is a parameter used to indicate an accesstechnology. In some embodiments, the other parameter may be in a form ofa bit or in a form of an ID. For example, it may be specified thatanother parameter corresponding to a 3GPP access technology is 0x01,another parameter corresponding to a non-3GPP access technology is 0x10,and another parameter corresponding to a fixed network access technologyis 0x11.

The other parameter may alternatively be a counter value. For example, astart value of the counter value is 0, and each time the AMF nodegenerates a NAS key, the counter value is increased by 1, to indicatethat the AMF node generates a new key.

Method 4: Generate a new NAS key based on an old NAS key.

The new NAS key=(the old NAS key, a counter value). For example, a startvalue of the counter value is 0, and each time the AMF node generates aNAS key, the counter value is increased by 1, to indicate that the AMFnode generates a new key.

It should be noted that if the AMF node generates a new NAS key, the AMFnode may instruct, using the NAS SMC message in the embodimentcorresponding to FIG. 11A and FIG. 11B, the terminal to update the keyin an explicit manner. After receiving an instruction of updating thekey, the terminal may update the key using one of the foregoing fourmethods. A method for updating a key by the terminal is the same as amethod for updating a NAS key by the AMF node, and a method for updatinga NAS key is pre-configured in both the AMF node and the terminal.

Optionally, when the AMF node and the terminal change a used accesstechnology, a NAS key may be updated. Alternatively, the NAS key may beupdated when a case of using a plurality of access technologies isswitched to a case of using only one access technology, or when aquantity of simultaneously used access technologies is reduced.

According to this method, a key is updated. Even if an attacker obtainsa NAS key used when the AMF node communicates with the terminal using aplurality of access technologies, the attacker cannot obtain a plaintextused when the terminal subsequently communicates with the AMF node usinga single access technology, thereby improving security.

It should be noted that, in the embodiments of this application, anexample in which a first access technology is a non-3GPP accesstechnology and a second access technology is a 3GPP access technology isused for description. Alternatively, in other examples, the first accesstechnology may be the 3GPP access technology, and the second accesstechnology may be the non-3GPP access technology. The method provided inthe foregoing embodiments may be used when the first access technologyand the second access technology are respectively two different accesstechnologies supported by the terminal, or the method provided in theforegoing embodiments may be used when the terminal accesses the corenetwork device using a plurality of access technologies.

For example, if the first access technology is a fixed network accesstechnology and the second access technology is a non-3GPP accesstechnology, an implementation method is similar to the method describedin the foregoing embodiments. The embodiment corresponding to FIG. 11Aand FIG. 11B may be applied to a scenario in which the terminal hasaccessed the AMF node using the 3GPP access technology, and thenaccesses the same AMF node using the fixed network access technology.The procedure in FIG. 11A and FIG. 11B may be replaced with aregistration process in which the terminal accesses an AMF node usingthe fixed network access technology. A security protection method in theregistration process is similar to the security protection method thatis described in the embodiment in FIG. 11A and FIG. 11B and in which theterminal accesses an AMF node using the non-3GPP access technology.

The foregoing mainly describes the solutions provided in the embodimentsof this application from a perspective of interaction between differentnetwork elements. It may be understood that to implement the foregoingfunctions, the terminal and the core network device includecorresponding hardware structures and/or software modules for performingthe functions. With reference to the examples described in theembodiments of this application, units and algorithm steps can beimplemented by hardware or a combination of hardware and computersoftware in the embodiments of this application. Whether a function isimplemented in a hardware manner or in a manner of driving hardware bycomputer software depends on a particular application and a designconstraint condition of the technical solutions. For each particularapplication, a person skilled in the art may use different methods toimplement the described functions, but it should not be considered thatthe implementation goes beyond the scope of the technical solutions ofthe embodiments of this application.

In the embodiments of this application, function unit division may beperformed on the terminal and the core network device based on theforegoing method examples. For example, each function unit may beobtained through division based on a corresponding function, or two ormore functions may be integrated into one processing unit. Theintegrated unit may be implemented in a form of hardware, or may beimplemented in a form of a software functional unit. It should be notedthat the unit division in the embodiments of this application is anexample, and is merely logical function division and may be anotherdivision in an actual implementation of the present application.

When an integrated unit is used, FIG. 12 shows a schematic block diagramof an apparatus 1200 according to an embodiment of this application. Theapparatus 1200 may exist in a form of software, or may be a terminal, ormay be a chip in a terminal. The apparatus 1200 includes a processingunit 1202 and a communications unit 1203. The processing unit 1202 isconfigured to control and manage an action of the apparatus 1200. Forexample, the processing unit 1202 is configured to support the apparatus1200 in performing step 501 and step 502 in FIG. 5, step 1001 in FIG.10, step 1101, step 1105, step 1113, step 1117, and step 1118 in FIG.11A and FIG. 11B, and/or another process of the technology described inthis specification. The communications unit 1203 is configured tosupport communication between the apparatus 1200 and another networkelement (such as a core network device and an N3IWF node). For example,the communications unit 1203 is configured to support the apparatus 1200in performing step 1002, step 1003, and step 1007 in FIG. 10, and step1102, step 1103, step 1104, step 1106, step 1112, step 1114, step 1116,and step 1119 in FIG. 11A and FIG. 11B. The apparatus 1200 may furtherinclude a storage unit 1201, configured to store program code and dataof the apparatus 1200.

The processing unit 1202 may be a processor or a controller, forexample, a central processing unit (CPU), a general-purpose processor, adigital signal processor (DSP), an application-specific integratedcircuit (ASIC), a field programmable gate array (FPGA) or anotherprogrammable logic device, a transistor logic device, a hardwarecomponent, or any combination thereof. The processing unit 1202 mayimplement or execute various examples of logical blocks, modules, andcircuits described with reference to content disclosed in thisapplication. Alternatively, the processor may be a combination forimplementing a computing function, for example, a combination of one ormore microprocessors or a combination of the DSP and a microprocessor.The communications unit 1203 may be a transceiver, a transceivercircuit, a communications interface, or the like. The storage unit 1201may be a memory.

When the processing unit 1202 is a processor, the communications unit1203 is a transceiver, and the storage unit 1201 is a memory, theapparatus 1200 in this embodiment of the present disclosure may be aterminal shown in FIG. 13.

FIG. 13 shows a simplified schematic diagram of a possible designstructure of a related terminal 1300 according to an embodiment of thisapplication. The terminal 1300 includes a transmitter 1301, a receiver1302, and a processor 1303. The processor 1303 may alternatively be acontroller, and is indicated as a “controller/processor 1303” in FIG.13. Optionally, the terminal 1300 may further include a modem processor1305, and the modem processor 1305 may include an encoder 1306, amodulator 1307, a decoder 1308, and a demodulator 1309.

In an example, the transmitter 1301 adjusts (for example, through analogconversion, filtering, amplification, and up-conversion) an outputsample and generates an uplink signal. The uplink signal is transmittedto the base station in the foregoing embodiments using an antenna. On adownlink, the antenna receives a downlink signal transmitted by the basestation in the foregoing embodiment. The receiver 1302 adjusts (forexample, through filtering, amplification, down-conversion, anddigitization) a signal received from the antenna and provides an inputsample. In the modem processor 1305, the encoder 1306 receives servicedata and a signaling message that are to be sent on an uplink, andprocesses (for example, through formatting, coding, and interleaving)the service data and the signaling message. The modulator 1307 furtherprocesses (for example, through symbol mapping and modulation) codedservice data and a coded signaling message, and provides an outputsample. The demodulator 1309 processes (for example, throughdemodulation) the input sample and provides symbol estimation. Thedecoder 1308 processes (for example, through de-interleaving anddecoding) the symbol estimation and provides decoded data and a decodedsignaling message that are to be sent to the terminal 1300. The encoder1306, the modulator 1307, the demodulator 1309, and the decoder 1308 maybe implemented by the integrated modem processor 1305. The units performprocessing based on a radio access technology (for example, accesstechnologies of LTE and another evolved system) used in a radio accessnetwork. It should be noted that when the terminal 1300 does not includethe modem processor 1305, the foregoing functions of the modem processor1305 may alternatively be implemented by the processor 1303.

The processor 1303 controls and manages an action of the terminal 1300,and is configured to execute processing processes performed by theterminal 1300 in the foregoing embodiments of this application. Forexample, the processor 1303 is further configured to execute aprocessing process related to a terminal in the method shown in FIG. 5,FIG. 10, and FIG. 11A and FIG. 11B, and/or another process of thetechnical solutions described in this application.

Further, the terminal 1300 may further include a memory 1304, and thememory 1304 is configured to store program code and data used for theterminal 1300.

When an integrated unit is used, FIG. 14 shows a schematic block diagramof another apparatus 1400 according to an embodiment of thisapplication. The apparatus 1400 may exist in a form of software, or maybe a core network device, or may be a chip in a core network device. Theapparatus 1400 includes a processing unit 1402 and a communications unit1403. The processing unit 1402 is configured to control and manage anaction of the apparatus 1400. For example, the processing unit 1402 isconfigured to support the apparatus 1400 in performing step 901 and step902 in FIG. 9, step 1004 to step 1006 in FIG. 10, step 1109 to step 1111in FIG. 11A and FIG. 11B, and/or another process of the technologydescribed in this specification. The communications unit 1403 isconfigured to support communication between the apparatus 1400 andanother network element (such as a terminal or an N3IWF node). Forexample, the communications unit 1403 is configured to support theapparatus 1400 in performing step 1001, step 1002, and step 1007 in FIG.10, and step 1108, step 1112, step 1114, and step 1115 in FIG. 11A andFIG. 11B. The apparatus 1400 may further include a storage unit 1401,configured to store program code and data of the apparatus 1400.

The processing unit 1402 may be a processor or a controller, forexample, a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA oranother programmable logic device, a transistor logic device, a hardwarecomponent, or any combination thereof. The processing unit 1402 mayimplement or execute various example logical blocks, modules, andcircuits described with reference to content disclosed in thisapplication. Alternatively, the processor 1402 may be a combination forimplementing a computing function, for example, a combination of one ormore microprocessors or a combination of the DSP and a microprocessor.The communications unit 1403 may be a communications interface. Thecommunications interface is a general name. In some implementations, thecommunications interface may include a plurality of interfaces. Forexample, the communications interface may include an interface between acore network device and a terminal, and an interface between a corenetwork device and an N3IWF node, and/or another interface. The storageunit 1401 may be a memory.

When the processing unit 1402 is a processor, the communications unit1403 is a communications interface, and the storage unit 1401 is amemory, a structure of the apparatus 1400 in this embodiment of thepresent disclosure may be a structure of a network device shown in FIG.15.

FIG. 15 shows a possible schematic structural diagram of a core networkdevice according to an embodiment of this application.

As shown in FIG. 15, a core network device 1500 includes a processor1502, a communications interface 1503, and a memory 1501. Optionally,the core network device 1500 may further include a bus 1504. Thecommunications interface 1503, the processor 1502, and the memory 1501may be connected to each other using the bus 1504. The bus 1504 may be aPCI bus, an EISA bus, or the like. The bus 1504 may be classified intoan address bus, a data bus, a control bus, and the like. For ease ofindication, the bus 1504 is indicated using only one bold line in FIG.15. However, it does not indicate that there is only one bus or only onetype of bus.

The methods or algorithm steps described with reference to the contentdisclosed in this application may be implemented in a hardware manner,or may be implemented in a manner of executing a software instruction bya processor. The software instruction may include a correspondingsoftware module. The software module may be stored in a random accessmemory (RAM), a flash memory, a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM), an electrically erasableprogrammable read-only memory (EEPROM), a register, a hard disk, aremovable hard disk, a compact disc read-only memory (CD-ROM), or astorage medium in any other forms well-known in the art. A storagemedium used as an example is coupled to the processor, such that theprocessor can read information from the storage medium, and can writeinformation into the storage medium. Certainly, the storage medium maybe a component of the processor. The processor and the storage mediummay be located in an ASIC. In addition, the ASIC may be located in acore network interface device. Certainly, the processor and the storagemedium may exist in the core network interface device as discretecomponents.

In the several embodiments provided in this application, it should beunderstood that the disclosed system, apparatus, and method may beimplemented in other manners. For example, the described apparatusembodiment is merely an example. For example, the unit division ismerely logical function division and may be other division in actualimplementation of the present application. For example, a plurality ofunits or components may be combined or integrated into another system,or some features may be ignored or not performed. In addition, thedisplayed or discussed mutual couplings or direct couplings orcommunication connections may be implemented through some interfaces.The indirect couplings or communication connections between theapparatuses or units may be implemented in electronic or other forms.

The units described as separate parts may or may not be physicallyseparate. Parts displayed as units may or may not be physical units, inother words, may be located in one position, or may be distributed on aplurality of network devices. Some or all of the units may be selectedaccording to actual needs to achieve the objectives of the solutions ofthe embodiments.

In addition, functional units in the embodiments of the presentdisclosure may be integrated into one processing unit, or each of thefunctional units may exist alone, or two or more units are integratedinto one unit. The integrated unit may be implemented in a form ofhardware, or may be implemented in a form of hardware in addition to asoftware functional unit.

Based on the foregoing descriptions of the implementations, a personskilled in the art may clearly understand that this application may beimplemented by software in addition to universal hardware or certainlyby hardware only. In most cases, the former is a preferredimplementation. Based on such an understanding, the technical solutionsof this application essentially or the part contributing to otherapproaches may be implemented in a form of a software product. Thecomputer software product is stored in a readable storage medium, suchas a floppy disk, a hard disk, or an optical disc of a computer, andincludes several instructions for instructing a computer device (whichmay be a personal computer, a server, or a network device) to performthe methods described in the embodiments of this application.

The foregoing descriptions are merely example embodiments of thisapplication, but are not intended to limit the protection scope of thisapplication. Any variation or replacement disclosed in this applicationshall fall within the protection scope of this application. Therefore,the protection scope of this application shall be subject to theprotection scope of the claims.

What is claimed is:
 1. A method of security protection for a non-accessstratum (NAS) message by an apparatus in a communication system, whereinthe method comprises: determining a type of access technology used fortransmitting the NAS message; determining a value of a first parameteraccording to the type of access technology used for transmitting the NASmessage, wherein the value of the first parameter indicates the type ofaccess technology used for transmitting the NAS message; and performingsecurity protection for the NAS message based on a NAS key, the firstparameter, and a COUNT, wherein the COUNT is set according to the typeof access technology used for transmitting the NAS message.
 2. Themethod of claim 1, wherein performing security protection for the NASmessage comprises at least one of: performing an encryption process or adecryption process for the NAS message using the NAS key, a BEARER, andthe COUNT as input parameters, wherein bits of the BEARER represent thevalue of the first parameter; or performing an integrity protectionprocess or an integrity protection verification process for the NASmessage using the NAS key, the BEARER, and the COUNT as inputparameters, wherein the bits of the BEARER represent the value of thefirst parameter.
 3. The method of claim 1, wherein the type of accesstechnology used for transmitting the NAS message comprises a 3rdGeneration Partnership Project (3GPP) access technology, and wherein thevalue of the first parameter indicates the 3GPP access technology. 4.The method of claim 1, wherein the type of access technology used fortransmitting the NAS message comprises a non-3GPP access technology, andwherein the value of the first parameter indicates the non-3GPP accesstechnology.
 5. The method of claim 1, wherein the COUNT includes 32bits, wherein 8 most significant bits of the COUNT are set to a value of0, and wherein 24 remaining bits of the COUNT are set to a value of aNAS COUNT associated with the type of access technology used fortransmitting the NAS message.
 6. The method of claim 1, wherein afterperforming the security protection for the NAS message, the methodfurther comprises sending the NAS message via the type of accesstechnology used for transmitting the NAS message, wherein the NASmessage includes some bits of the COUNT.
 7. The method of claim 1,wherein determining the value of the first parameter comprisesdetermining the value of the first parameter according to aconfiguration, wherein the configuration indicates that the firstparameter is set to a first value if the type of access technology usedfor transmitting the NAS message is a 3GPP access technology, or thefirst parameter is set to a second value if the type of accesstechnology used for transmitting the NAS message is a non-3GPP accesstechnology.
 8. An apparatus, comprising: at least one processor; and amemory coupled to the processor and having program instructions storedthereon which, when executed by the at least one processor, cause theapparatus to: determine a type of access technology used fortransmitting a NAS message; determine a value of a first parameteraccording to the type of access technology used for transmitting the NASmessage, wherein the value of the first parameter indicates the type ofaccess technology used for transmitting the NAS message; and performsecurity protection for the NAS message based on a NAS key, the firstparameter, and a COUNT, wherein the COUNT is set according to the typeof access technology used for transmitting the NAS message.
 9. Theapparatus of claim 8, wherein the instructions that cause the apparatusto perform security protection for the NAS message include instructionsthat cause the apparatus to perform at least one of: an encryptionprocess or a decryption process for the NAS message using the NAS key, aBEARER, and the COUNT as input parameters, wherein bits of the BEARERrepresent the value of the first parameter; or an integrity protectionprocess or an integrity protection verification process for the NASmessage using the NAS key, the BEARER, and the COUNT as inputparameters, wherein bits of the BEARER represent the value of the firstparameter.
 10. The apparatus of claim 8, wherein the type of accesstechnology used for transmitting the NAS message comprises a 3rdGeneration Partnership Project (3GPP) access technology, and wherein thevalue of the first parameter indicates the 3GPP access technology. 11.The apparatus of claim 8, wherein the type of access technology used fortransmitting the NAS message comprises a non-3GPP access technology, andwherein the value of the first parameter indicates the non-3GPP accesstechnology.
 12. The apparatus of claim 8, wherein the COUNT includes 32bits, wherein 8 most significant bits of the COUNT are set to a value of0, and wherein 24 remaining bits of the COUNT are set to a value of aNAS COUNT associated with the type of access technology used fortransmitting the NAS message.
 13. The apparatus of claim 8, wherein theprogram instructions, when executed by the processor, further cause theapparatus to send the NAS message via the type of access technology usedfor transmitting the NAS message, and wherein the NAS message includessome bits of the COUNT.
 14. The apparatus of claim 8, wherein theinstructions further cause the apparatus to determine the value of thefirst parameter according to a configuration, wherein the configurationindicates the first parameter is set to a first value if the type ofaccess technology used for transmitting the NAS message is a 3GPP accesstechnology, or the first parameter is set to a second value if the typeof access technology used for transmitting the NAS message is a non-3GPPaccess technology.
 15. The apparatus of claim 8, wherein the apparatusis a terminal device or a chip in the terminal device.
 16. The apparatusof claim 8, wherein the apparatus is an access and mobility managementfunction (AMF) node.
 17. A computer program product embodied on anon-transitory computer readable storage medium, wherein the computerprogram product comprises instructions which, when executed by acomputer cause the computer to: determine a type of access technologyused for transmitting a NAS message; determine a value of a firstparameter according to the type of access technology used fortransmitting the NAS message, wherein the value of the first parameterindicates the type of access technology used for transmitting the NASmessage; and perform security protection for the NAS message based on aNAS key, the first parameter, and a COUNT, wherein the COUNT is setaccording to the type of access technology used for transmitting the NASmessage.
 18. The computer program product of claim 17, wherein theinstructions further cause the computer to perform at least one of: anencryption process or a decryption process for the NAS message using theNAS key, a BEARER, and the COUNT as input parameters, wherein bits ofthe BEARER represent the value of the first parameter; or an integrityprotection process or an integrity protection verification process forthe NAS message using the NAS key, the BEARER, and the COUNT as inputparameters, wherein bits of the BEARER represent the value of the firstparameter.
 19. The computer program product of claim 17, wherein theCOUNT includes 32 bits, wherein 8 most significant bits of the COUNT areset to a value of 0, and wherein 24 remaining bits of the COUNT are setto a value of a NAS COUNT associated with the type of access technologyused for transmitting the NAS message.
 20. The computer program productof claim 17, wherein the instructions further cause the computer todetermine the value of the first parameter according to a configuration,wherein the configuration indicates that the first parameter is set to afirst value if the type of access technology used for transmitting theNAS message is a 3GPP access technology, or the first parameter is setto a second value if the type of access technology used for transmittingthe NAS message is a non-3GPP access technology.